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-- basic stream filter tests --FILE-- <?php $text = "Hello There!"; $filters = arra..
Decoded Output download
--TEST--
basic stream filter tests
--FILE--
<?php
$text = "Hello There!";
$filters = array("string.rot13", "string.toupper", "string.tolower");
function filter_test($names)
{
$fp = tmpfile();
fwrite($fp, $GLOBALS["text"]);
rewind($fp);
foreach ($names as $name) {
echo "filter: $name
";
var_dump(stream_filter_prepend($fp, $name));
}
var_dump(fgets($fp));
fclose($fp);
}
foreach ($filters as $filter) {
filter_test(array($filter));
}
filter_test(array($filters[0], $filters[1]));
?>
--EXPECTF--
filter: string.rot13
resource(%d) of type (stream filter)
string(12) "Uryyb Gurer!"
filter: string.toupper
resource(%d) of type (stream filter)
string(12) "HELLO THERE!"
filter: string.tolower
resource(%d) of type (stream filter)
string(12) "hello there!"
filter: string.rot13
resource(%d) of type (stream filter)
filter: string.toupper
resource(%d) of type (stream filter)
string(12) "URYYB GURER!"
Did this file decode correctly?
Original Code
--TEST--
basic stream filter tests
--FILE--
<?php
$text = "Hello There!";
$filters = array("string.rot13", "string.toupper", "string.tolower");
function filter_test($names)
{
$fp = tmpfile();
fwrite($fp, $GLOBALS["text"]);
rewind($fp);
foreach ($names as $name) {
echo "filter: $name\n";
var_dump(stream_filter_prepend($fp, $name));
}
var_dump(fgets($fp));
fclose($fp);
}
foreach ($filters as $filter) {
filter_test(array($filter));
}
filter_test(array($filters[0], $filters[1]));
?>
--EXPECTF--
filter: string.rot13
resource(%d) of type (stream filter)
string(12) "Uryyb Gurer!"
filter: string.toupper
resource(%d) of type (stream filter)
string(12) "HELLO THERE!"
filter: string.tolower
resource(%d) of type (stream filter)
string(12) "hello there!"
filter: string.rot13
resource(%d) of type (stream filter)
filter: string.toupper
resource(%d) of type (stream filter)
string(12) "URYYB GURER!"
Function Calls
tmpfile | 1 |
filter_test | 1 |
Stats
MD5 | 73b627b1448a2b96ba53a9e500945e02 |
Eval Count | 0 |
Decode Time | 115 ms |