xref: /PHP-7.4/ext/standard/tests/file/bug43522.phpt (revision b9e44139)
1--TEST--
2Bug #43522 (stream_get_line() eats additional characters)
3--FILE--
4<?php // 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ
5
6$fp = fopen(__FILE__, 'r'); // Open self
7
8DoTest($fp, 'ZZZ');  // test multi-char delimiter
9DoTest($fp, "Z");  // test single-char delimiter
10
11function DoTest($fp, $delim) {
12	echo "Delimiter:  " . $delim . "\n";
13	rewind($fp);
14	echo "\t" . stream_get_line($fp, 10, $delim) . "\n";
15	echo "\t" . stream_get_line($fp, 10, $delim) . "\n";
16}
17
18?>
19--EXPECT--
20Delimiter:  ZZZ
21	<?php // 1
22	234567890A
23Delimiter:  Z
24	<?php // 1
25	234567890A
26