mirror of
https://github.com/php/php-src.git
synced 2026-04-22 23:48:14 +02:00
05560b67bc
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.
15 lines
306 B
PHP
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.
|