mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
76601c4fd1
stream_get_line() could contain the delimiter string if that string had more than one character. The bug manifested itself when a read on the stream ended with part of the delimiter string and the read after would start with the rest of the delimiter string; provided that the data of first read did not complete the max length result of the call to stream_get_line() with the partial delimiter used in that max length return. In that case, the delimiter will still appear in the result, divided in two subsequent return values. That is not a bug. See <http://www.mail-archive.com/internals@lists.php.net/msg61325.html>
18 lines
402 B
PHP
18 lines
402 B
PHP
--TEST--
|
|
Bug #63240: stream_get_line() return contains delimiter string
|
|
--FILE--
|
|
<?php
|
|
$fd = fopen('php://temp', 'r+');
|
|
$delimiter = 'MM';
|
|
$str = str_repeat('.', 8191) . $delimiter . "rest";
|
|
fwrite($fd, $str);
|
|
rewind($fd);
|
|
$line = stream_get_line($fd, 9000, $delimiter);
|
|
var_dump(strlen($line));
|
|
$line = stream_get_line($fd, 9000, $delimiter);
|
|
var_dump($line);
|
|
?>
|
|
--EXPECT--
|
|
int(8191)
|
|
string(4) "rest"
|