diff options
| author | Sara Golemon <pollita@php.net> | 2017-11-13 06:11:59 -0500 |
|---|---|---|
| committer | Sara Golemon <pollita@php.net> | 2017-11-13 09:40:34 -0500 |
| commit | 0a45e8f096a04464bda6277c6f3d0b5461737a27 (patch) | |
| tree | 11d15c12214d564c9ec22bca684f08986368dd59 /main/streams/streams.c | |
| parent | 704bcd385f4dfc28db54aa5d3c46c30ea1107695 (diff) | |
| download | php-git-0a45e8f096a04464bda6277c6f3d0b5461737a27.tar.gz | |
Bugfix#75515 php://streams behaving greedily
5060fc23 attempted to fix #68948 by treating all non-uri streams
as non-blocking, however php://fd/* streams (which includes stdin)
may block if the other end of the IPC isn't finished.
This represents a partial revert to the pre RC6 state,
but includes an escape hatch for php://memory and php://temp
streams which are local to the current process.
This also restores stream_set_chunk_size test to previous state.
Diffstat (limited to 'main/streams/streams.c')
| -rw-r--r-- | main/streams/streams.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c index b1099b6fcc..19d08c7978 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -24,6 +24,7 @@ #define _GNU_SOURCE #include "php.h" #include "php_globals.h" +#include "php_memory_streams.h" #include "php_network.h" #include "php_open_temporary_file.h" #include "ext/standard/file.h" @@ -709,8 +710,10 @@ PHPAPI size_t _php_stream_read(php_stream *stream, char *buf, size_t size) break; } - /* just break anyway, to avoid greedy read */ - if (!stream->wrapper || stream->wrapper->is_url) { + /* just break anyway, to avoid greedy read for file://, php://memory, and php://temp */ + if ((stream->wrapper != &php_plain_files_wrapper) && + (stream->ops != &php_stream_memory_ops) && + (stream->ops != &php_stream_temp_ops)) { break; } } |
