summaryrefslogtreecommitdiff
path: root/main/streams/cast.c
diff options
context:
space:
mode:
authorArnaud Le Blanc <lbarnaud@php.net>2009-04-19 13:46:47 +0000
committerArnaud Le Blanc <lbarnaud@php.net>2009-04-19 13:46:47 +0000
commit14c717f449934f1fd611451c20a95344635fc83b (patch)
treeb26ac7e9e868e09527519aa20b58b66a7cbcd0e8 /main/streams/cast.c
parent0c6cf02985c4d4b847a0228344ad1358b3676cbe (diff)
downloadphp-git-14c717f449934f1fd611451c20a95344635fc83b.tar.gz
Fixed bug #47997 (stream_copy_to_stream returns 1 on empty streams)
Diffstat (limited to 'main/streams/cast.c')
-rw-r--r--main/streams/cast.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/main/streams/cast.c b/main/streams/cast.c
index dea72da53d..06805c709c 100644
--- a/main/streams/cast.c
+++ b/main/streams/cast.c
@@ -214,9 +214,9 @@ PHPAPI int _php_stream_cast(php_stream *stream, int castas, void **ret, int show
newstream = php_stream_fopen_tmpfile();
if (newstream) {
- size_t copied = php_stream_copy_to_stream(stream, newstream, PHP_STREAM_COPY_ALL);
+ size_t copied = php_stream_copy_to_stream_ex(stream, newstream, PHP_STREAM_COPY_ALL);
- if (copied == 0) {
+ if (copied == PHP_STREAM_FAILURE) {
php_stream_close(newstream);
} else {
int retcode = php_stream_cast(newstream, castas | flags, ret, show_err);
@@ -332,7 +332,7 @@ PHPAPI int _php_stream_make_seekable(php_stream *origstream, php_stream **newstr
(*newstream)->open_lineno = origstream->open_lineno;
#endif
- if (php_stream_copy_to_stream(origstream, *newstream, PHP_STREAM_COPY_ALL) == 0) {
+ if (php_stream_copy_to_stream_ex(origstream, *newstream, PHP_STREAM_COPY_ALL) == PHP_STREAM_FAILURE) {
php_stream_close(*newstream);
*newstream = NULL;
return PHP_STREAM_CRITICAL;