summaryrefslogtreecommitdiff
path: root/main/streams/streams.c
diff options
context:
space:
mode:
authorGreg Beaver <cellog@php.net>2008-09-22 01:26:14 +0000
committerGreg Beaver <cellog@php.net>2008-09-22 01:26:14 +0000
commit17cfd5f24e2d73f74472a1f27e4e69ee8bea3f12 (patch)
tree8d3932cf325cef7154374ce65db0134c4e3e78d7 /main/streams/streams.c
parent5c95af8be3b2d53b51deb7fcdec16fa6ca0f8c74 (diff)
downloadphp-git-17cfd5f24e2d73f74472a1f27e4e69ee8bea3f12.tar.gz
MF52 fix Bug #46147: after stream seek, appending stream filter reads incorrect data
Diffstat (limited to 'main/streams/streams.c')
-rwxr-xr-xmain/streams/streams.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 65421c299d..ce25c27393 100755
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -448,6 +448,10 @@ static void php_stream_fill_read_buffer(php_stream *stream, size_t size TSRMLS_D
php_stream_bucket_brigade brig_in = { NULL, NULL }, brig_out = { NULL, NULL };
php_stream_bucket_brigade *brig_inp = &brig_in, *brig_outp = &brig_out, *brig_swap;
+ /* Invalidate the existing cache, otherwise reads can fail, see note in
+ main/streams/filter.c::_php_stream_filter_append */
+ stream->writepos = stream->readpos = 0;
+
/* allocate a buffer for reading chunks */
chunk_buf = emalloc(stream->chunk_size);