]> granicus.if.org Git - php/commitdiff
Fixed bug #22234
authorMoriyoshi Koizumi <moriyoshi@php.net>
Sat, 15 Feb 2003 19:56:12 +0000 (19:56 +0000)
committerMoriyoshi Koizumi <moriyoshi@php.net>
Sat, 15 Feb 2003 19:56:12 +0000 (19:56 +0000)
main/streams.c

index 2a97033e4a7f8c8abbe455de2f7ab46b293fcd6d..67e961540be9a569c2a5da2449b5daa4b3d39821 100755 (executable)
@@ -1207,6 +1207,17 @@ PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size
        }
 #endif
 
+       {
+               php_stream_statbuf sbuf;
+               if (php_stream_stat(src, &sbuf TSRMLS_CC) == 0) {
+                       /* in the event that the source file is 0 bytes, return 1 to indicate success
+                        * because opening the file to write had already created a copy */
+                       if (sbuf.sb.st_size == 0) {
+                               return 1;
+                       }
+               }
+       }
+
        while(1) {
                readchunk = sizeof(buf);