1
0
mirror of https://github.com/php/php-src.git synced 2026-04-22 23:48:14 +02:00
Files
archived-php-src/ext/standard/tests/streams/bug46147.phpt
T
Konstantin Kopachev 05560b67bc Fix #76859 stream_get_line skips data if used with data-generating filter
stream_get-line repeatedly calls php_stream_fill_read_buffer until
enough data is accumulated in buffer. However, when stream contains
filters attached to it, then each call to fill buffer essentially
resets buffer read/write pointers and new data is written over old.
This causes stream_get_line to skip parts of data from stream
This patch fixes such behavior, so fill buffer call will append.
2019-10-03 06:50:43 +02:00

15 lines
306 B
PHP

--TEST--
Bug #46147 (after stream seek, appending stream filter reads incorrect data)
--FILE--
<?php
$fp = tmpfile();
fwrite($fp, "this is a lowercase string.\n");
fseek($fp, 5);
stream_filter_append($fp, "string.toupper");
while (!feof($fp)) {
echo fread($fp, 5);
}
--EXPECT--
IS A LOWERCASE STRING.