Skip to content

Commit 22517ce

Browse files
author
Moriyoshi Koizumi
committed
Fixed bug #22234
1 parent e035fe1 commit 22517ce

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

main/streams.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,17 @@ PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest, size
12071207
}
12081208
#endif
12091209

1210+
{
1211+
php_stream_statbuf sbuf;
1212+
if (php_stream_stat(src, &sbuf TSRMLS_CC) == 0) {
1213+
/* in the event that the source file is 0 bytes, return 1 to indicate success
1214+
* because opening the file to write had already created a copy */
1215+
if (sbuf.sb.st_size == 0) {
1216+
return 1;
1217+
}
1218+
}
1219+
}
1220+
12101221
while(1) {
12111222
readchunk = sizeof(buf);
12121223

0 commit comments

Comments
 (0)