From: Moriyoshi Koizumi Date: Sat, 15 Feb 2003 19:59:26 +0000 (+0000) Subject: MFH(r1.155): Fixed bug #22234 X-Git-Tag: php-4.3.2RC1~196 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b298ce0dd03148c3447592dcd7294931fd6f6cbb;p=php MFH(r1.155): Fixed bug #22234 --- diff --git a/main/streams.c b/main/streams.c index 45eee09077..6b3a020dd1 100755 --- a/main/streams.c +++ b/main/streams.c @@ -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);