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 #44034 --INI-- allow_url_fopen=1 --FILE-- <?php $urls = array(); $urls[] = "..
Decoded Output download
--TEST--
Bug #44034
--INI--
allow_url_fopen=1
--FILE--
<?php
$urls = array();
$urls[] = "data://text/plain,foo
bar
";
$urls[] = "data://text/plain,
foo
bar
";
$urls[] = "data://text/plain,foo
bar";
foreach($urls as $url) {
echo strtr($url, array("
" => "\r", "
" => "\n")) . "
";
var_dump(file($url, FILE_IGNORE_NEW_LINES));
}
?>
--EXPECT--
data://text/plain,foo
bar
array(2) {
[0]=>
string(3) "foo"
[1]=>
string(3) "bar"
}
data://text/plain,
foo
bar
array(3) {
[0]=>
string(0) ""
[1]=>
string(3) "foo"
[2]=>
string(3) "bar"
}
data://text/plain,foo
bar
array(2) {
[0]=>
string(3) "foo"
[1]=>
string(3) "bar"
}
Did this file decode correctly?
Original Code
--TEST--
Bug #44034
--INI--
allow_url_fopen=1
--FILE--
<?php
$urls = array();
$urls[] = "data://text/plain,foo\r\nbar\r\n";
$urls[] = "data://text/plain,\r\nfoo\r\nbar\r\n";
$urls[] = "data://text/plain,foo\r\nbar";
foreach($urls as $url) {
echo strtr($url, array("\r" => "\\r", "\n" => "\\n")) . "\n";
var_dump(file($url, FILE_IGNORE_NEW_LINES));
}
?>
--EXPECT--
data://text/plain,foo\r\nbar\r\n
array(2) {
[0]=>
string(3) "foo"
[1]=>
string(3) "bar"
}
data://text/plain,\r\nfoo\r\nbar\r\n
array(3) {
[0]=>
string(0) ""
[1]=>
string(3) "foo"
[2]=>
string(3) "bar"
}
data://text/plain,foo\r\nbar
array(2) {
[0]=>
string(3) "foo"
[1]=>
string(3) "bar"
}
Function Calls
strtr | 1 |
Stats
MD5 | 369ab8960ba8d7dc02bd2ed7b8d8e537 |
Eval Count | 0 |
Decode Time | 110 ms |