summaryrefslogtreecommitdiff
path: root/ext/standard/tests/streams/bug60455_04.phpt
blob: 3a82298dbcdff0bcc0146e8d366919361bc867b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--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)