mirror of
https://github.com/php/php-src.git
synced 2024-10-01 14:56:10 +00:00
f5a4573182
together with the last read). - Fixed bug #60817 (stream_get_line() reads from stream even when there is already sufficient data buffered). stream_get_line() now behaves more like fgets(), as is documented. #withheld commit to 5.4
33 lines
596 B
PHP
33 lines
596 B
PHP
--TEST--
|
|
Bug #60455: stream_get_line and 1-line with maxlen size followed by 0-length
|
|
read with EOL indication
|
|
--FILE--
|
|
<?php
|
|
class TestStream {
|
|
private $s = 0;
|
|
function stream_open($path, $mode, $options, &$opened_path) {
|
|
return true;
|
|
}
|
|
function stream_read($count) {
|
|
if ($this->s++ == 0)
|
|
return "a\n";
|
|
|
|
return "";
|
|
}
|
|
function stream_eof() {
|
|
return $this->s >= 2;
|
|
}
|
|
|
|
}
|
|
|
|
stream_wrapper_register("test", "TestStream");
|
|
|
|
$f = fopen("test://", "r");
|
|
while (!feof($f)) {
|
|
$line = stream_get_line($f, 2, "\n");
|
|
var_dump($line);
|
|
}
|
|
--EXPECT--
|
|
string(1) "a"
|
|
bool(false)
|