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 #29038 (extract(), EXTR_PREFIX_SAME option prefixes empty strings) --FILE-- <..
Decoded Output download
--TEST--
Bug #29038 (extract(), EXTR_PREFIX_SAME option prefixes empty strings)
--FILE--
<?php
function my_print_r($a) {
ksort($a);
print_r($a);
}
function f1() {
$c = extract(array("" => 1),EXTR_PREFIX_SAME,"prefix");
echo "Extracted:";
var_dump($c);
my_print_r(get_defined_vars());
}
function f2() {
$a = 1;
$c = extract(array("a" => 1),EXTR_PREFIX_SAME,"prefix");
echo "Extracted:";
var_dump($c);
my_print_r(get_defined_vars());
}
function f3() {
$a = 1;
$c = extract(array("a" => 1),EXTR_PREFIX_ALL,"prefix");
echo "Extracted:";
var_dump($c);
my_print_r(get_defined_vars());
}
function f4() {
$c = extract(array("" => 1),EXTR_PREFIX_ALL,"prefix");
echo "Extracted:";
var_dump($c);
my_print_r(get_defined_vars());
}
function f5() {
$c = extract(array("111" => 1),EXTR_PREFIX_ALL,"prefix");
echo "Extracted:";
var_dump($c);
my_print_r(get_defined_vars());
}
f1();
f2();
f3();
f4();
f5();
?>
--EXPECT--
Extracted:int(0)
Array
(
[c] => 0
)
Extracted:int(1)
Array
(
[a] => 1
[c] => 1
[prefix_a] => 1
)
Extracted:int(1)
Array
(
[a] => 1
[c] => 1
[prefix_a] => 1
)
Extracted:int(0)
Array
(
[c] => 0
)
Extracted:int(1)
Array
(
[c] => 1
[prefix_111] => 1
)
Did this file decode correctly?
Original Code
--TEST--
Bug #29038 (extract(), EXTR_PREFIX_SAME option prefixes empty strings)
--FILE--
<?php
function my_print_r($a) {
ksort($a);
print_r($a);
}
function f1() {
$c = extract(array("" => 1),EXTR_PREFIX_SAME,"prefix");
echo "Extracted:";
var_dump($c);
my_print_r(get_defined_vars());
}
function f2() {
$a = 1;
$c = extract(array("a" => 1),EXTR_PREFIX_SAME,"prefix");
echo "Extracted:";
var_dump($c);
my_print_r(get_defined_vars());
}
function f3() {
$a = 1;
$c = extract(array("a" => 1),EXTR_PREFIX_ALL,"prefix");
echo "Extracted:";
var_dump($c);
my_print_r(get_defined_vars());
}
function f4() {
$c = extract(array("" => 1),EXTR_PREFIX_ALL,"prefix");
echo "Extracted:";
var_dump($c);
my_print_r(get_defined_vars());
}
function f5() {
$c = extract(array("111" => 1),EXTR_PREFIX_ALL,"prefix");
echo "Extracted:";
var_dump($c);
my_print_r(get_defined_vars());
}
f1();
f2();
f3();
f4();
f5();
?>
--EXPECT--
Extracted:int(0)
Array
(
[c] => 0
)
Extracted:int(1)
Array
(
[a] => 1
[c] => 1
[prefix_a] => 1
)
Extracted:int(1)
Array
(
[a] => 1
[c] => 1
[prefix_a] => 1
)
Extracted:int(0)
Array
(
[c] => 0
)
Extracted:int(1)
Array
(
[c] => 1
[prefix_111] => 1
)
Function Calls
f1 | 1 |
Stats
MD5 | 69e07476ee7a401d15db135d96a75f53 |
Eval Count | 0 |
Decode Time | 88 ms |