mirror of
https://github.com/php/php-src.git
synced 2026-04-27 01:48:26 +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.
23 lines
363 B
PHP
23 lines
363 B
PHP
--TEST--
|
|
Bug #76859 (stream_get_line skips data if used with filters)
|
|
--FILE--
|
|
<?php
|
|
|
|
$data = '123';
|
|
|
|
$fh = fopen('php://memory', 'r+b');
|
|
fwrite($fh, $data);
|
|
rewind($fh);
|
|
stream_filter_append($fh, 'string.rot13', STREAM_FILTER_READ);
|
|
|
|
$out = '';
|
|
while (!feof($fh)) {
|
|
$out .= stream_get_line($fh, 1024);
|
|
}
|
|
|
|
fclose($fh);
|
|
|
|
echo strlen($out) . "\n";
|
|
--EXPECT--
|
|
3
|