summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2003-02-15 19:56:12 +0000
committerMoriyoshi Koizumi <moriyoshi@php.net>2003-02-15 19:56:12 +0000
commit22517ce0de20456ced990e4ae74267a61f54d590 (patch)
tree08192ea1bf449c4752b45e0d287d089c85d4f3c4
parente035fe14e0681f9ebc78897bc84c5c6b6d24474a (diff)
downloadphp-git-22517ce0de20456ced990e4ae74267a61f54d590.tar.gz
Fixed bug #22234
-rwxr-xr-xmain/streams.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/main/streams.c b/main/streams.c
index 2a97033e4a..67e961540b 100755
--- a/main/streams.c
+++ b/main/streams.c
@@ -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);