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 #48309 (stream_copy_to_stream() and fpasstru() do not update stream position)..
Decoded Output download
--TEST--
Bug #48309 (stream_copy_to_stream() and fpasstru() do not update stream position)
--FILE--
<?php
$tmp = tmpfile();
fwrite($tmp, 'test');
fseek($tmp, 0, SEEK_SET);
echo "-- stream_copy_to_stream() --
";
fseek($tmp, 0, SEEK_SET);
stream_copy_to_stream($tmp, STDOUT, 2);
echo "
";
var_dump(stream_get_contents($tmp));
echo "-- fpassthru() --
";
fseek($tmp, 0, SEEK_SET);
fpassthru($tmp);
echo "
";
var_dump(stream_get_contents($tmp));
?>
--EXPECT--
-- stream_copy_to_stream() --
te
string(2) "st"
-- fpassthru() --
test
string(0) ""
Did this file decode correctly?
Original Code
--TEST--
Bug #48309 (stream_copy_to_stream() and fpasstru() do not update stream position)
--FILE--
<?php
$tmp = tmpfile();
fwrite($tmp, 'test');
fseek($tmp, 0, SEEK_SET);
echo "-- stream_copy_to_stream() --\n";
fseek($tmp, 0, SEEK_SET);
stream_copy_to_stream($tmp, STDOUT, 2);
echo "\n";
var_dump(stream_get_contents($tmp));
echo "-- fpassthru() --\n";
fseek($tmp, 0, SEEK_SET);
fpassthru($tmp);
echo "\n";
var_dump(stream_get_contents($tmp));
?>
--EXPECT--
-- stream_copy_to_stream() --
te
string(2) "st"
-- fpassthru() --
test
string(0) ""
Function Calls
tmpfile | 1 |
Stats
MD5 | fb725b70004896f220bffae5940b289e |
Eval Count | 0 |
Decode Time | 121 ms |