Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- Bug #60455: stream_get_line and 1-line followed by eol input --FILE-- <?php class..
Decoded Output download
--TEST--
Bug #60455: stream_get_line and 1-line followed by eol input
--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
";
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, 99, "
");
var_dump($line);
}
?>
--EXPECT--
string(1) "a"
bool(false)
Did this file decode correctly?
Original Code
--TEST--
Bug #60455: stream_get_line and 1-line followed by eol input
--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, 99, "\n");
var_dump($line);
}
?>
--EXPECT--
string(1) "a"
bool(false)
Function Calls
None |
Stats
MD5 | 409164c004ad74ab1d0470533dc2998e |
Eval Count | 0 |
Decode Time | 103 ms |