-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug in new stream_get_line() when using NUL as a delimiter.
This is the issue Derick spotted a few days ago..
- Loading branch information
1 parent
9bf8cd4
commit 0f180a6
Showing
2 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
ext/standard/tests/streams/stream_get_line_NUL_delimiter.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--TEST-- | ||
Bug #60455: stream_get_line and \0 as a delimiter | ||
--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\0"; | ||
|
||
return ""; | ||
} | ||
function stream_eof() { | ||
return $this->s >= 2; | ||
} | ||
|
||
} | ||
|
||
stream_wrapper_register("test", "TestStream"); | ||
|
||
$f = fopen("test://", "r"); | ||
var_dump(stream_get_line($f, 100, "\0")); | ||
--EXPECT-- | ||
string(1) "a" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters