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 #36975 (natcasesort() causes array_pop() to misbehave) --FILE-- <?php $a = ar..

Decoded Output download

--TEST--
Bug #36975 (natcasesort() causes array_pop() to misbehave)
--FILE--
<?php
$a = array('aa', 'aa', 'bb', 'bb', 'cc', 'cc');
$test = natcasesort($a);
if ($test) {
  echo "natcasesort success!
";
}
$val = array_pop($a);
$a[] = $val;
var_dump($a);

$b = array(1 => 'foo', 0 => 'baz');
array_pop($b);
$b[] = 'bar';
array_push($b, 'bar');
print_r($b);

$c = array(0, 0, 0, 0, 0);
asort($c);
array_pop($c);
$c[] = 'foo';
$c[] = 'bar';
var_dump($c);
?>
--EXPECT--
natcasesort success!
array(6) {
  [0]=>
  string(2) "aa"
  [1]=>
  string(2) "aa"
  [2]=>
  string(2) "bb"
  [3]=>
  string(2) "bb"
  [4]=>
  string(2) "cc"
  [5]=>
  string(2) "cc"
}
Array
(
    [1] => foo
    [2] => bar
    [3] => bar
)
array(6) {
  [0]=>
  int(0)
  [1]=>
  int(0)
  [2]=>
  int(0)
  [3]=>
  int(0)
  [4]=>
  string(3) "foo"
  [5]=>
  string(3) "bar"
}

Did this file decode correctly?

Original Code

--TEST--
Bug #36975 (natcasesort() causes array_pop() to misbehave)
--FILE--
<?php
$a = array('aa', 'aa', 'bb', 'bb', 'cc', 'cc');
$test = natcasesort($a);
if ($test) {
  echo "natcasesort success!\n";
}
$val = array_pop($a);
$a[] = $val;
var_dump($a);

$b = array(1 => 'foo', 0 => 'baz');
array_pop($b);
$b[] = 'bar';
array_push($b, 'bar');
print_r($b);

$c = array(0, 0, 0, 0, 0);
asort($c);
array_pop($c);
$c[] = 'foo';
$c[] = 'bar';
var_dump($c);
?>
--EXPECT--
natcasesort success!
array(6) {
  [0]=>
  string(2) "aa"
  [1]=>
  string(2) "aa"
  [2]=>
  string(2) "bb"
  [3]=>
  string(2) "bb"
  [4]=>
  string(2) "cc"
  [5]=>
  string(2) "cc"
}
Array
(
    [1] => foo
    [2] => bar
    [3] => bar
)
array(6) {
  [0]=>
  int(0)
  [1]=>
  int(0)
  [2]=>
  int(0)
  [3]=>
  int(0)
  [4]=>
  string(3) "foo"
  [5]=>
  string(3) "bar"
}

Function Calls

natcasesort 1

Variables

$a [{'key': 0, 'value': 'aa'}, {'key': 1, 'value': 'aa'}, {'key': 2, 'value': 'bb'}, {'key': 3, 'value': 'bb'}, {'key': 4, 'value': 'cc'}, {'key': 5, 'value': 'cc'}]

Stats

MD5 5256408b03213914e084ae5e6da4fb6b
Eval Count 0
Decode Time 87 ms