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

index 45eee090775838f69137b0c4433a8cf34ecbb823..6b3a020dd16a9c2f983d7a903f420dae839e8e2d 100755 (executable)
@@ -1201,6 +1201,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);