diff options
Diffstat (limited to 'ext/standard/file.c')
-rw-r--r-- | ext/standard/file.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c index 192d7f1cc2..a3b96b3b1b 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -627,7 +627,10 @@ PHP_FUNCTION(file_put_contents) switch (Z_TYPE_P(data)) { case IS_RESOURCE: - numbytes = php_stream_copy_to_stream(srcstream, stream, PHP_STREAM_COPY_ALL); + numbytes = (int) php_stream_copy_to_stream_ex(srcstream, stream, PHP_STREAM_COPY_ALL); + if ((size_t)numbytes == PHP_STREAM_FAILURE) { + numbytes = -1; + } break; case IS_NULL: case IS_LONG: @@ -1783,7 +1786,7 @@ safe_to_copy: deststream = php_stream_open_wrapper(dest, "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL); if (srcstream && deststream) { - ret = php_stream_copy_to_stream(srcstream, deststream, PHP_STREAM_COPY_ALL) == 0 ? FAILURE : SUCCESS; + ret = php_stream_copy_to_stream_ex(srcstream, deststream, PHP_STREAM_COPY_ALL) == PHP_STREAM_FAILURE ? FAILURE : SUCCESS; } if (srcstream) { php_stream_close(srcstream); |