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-- Can't use exchangeArray() while ArrayObject is being sorted --FILE-- <?php $ao =..
Decoded Output download
--TEST--
Can't use exchangeArray() while ArrayObject is being sorted
--FILE--
<?php
$ao = new ArrayObject([1, 2, 3]);
$i = 0;
$ao->uasort(function($a, $b) use ($ao, &$i) {
if ($i++ == 0) {
try {
$ao->exchangeArray([4, 5, 6]);
} catch (Error $e) {
echo $e->getMessage(), "
";
}
var_dump($ao);
}
return $a <=> $b;
});
?>
--EXPECT--
Modification of ArrayObject during sorting is prohibited
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
}
Did this file decode correctly?
Original Code
--TEST--
Can't use exchangeArray() while ArrayObject is being sorted
--FILE--
<?php
$ao = new ArrayObject([1, 2, 3]);
$i = 0;
$ao->uasort(function($a, $b) use ($ao, &$i) {
if ($i++ == 0) {
try {
$ao->exchangeArray([4, 5, 6]);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump($ao);
}
return $a <=> $b;
});
?>
--EXPECT--
Modification of ArrayObject during sorting is prohibited
object(ArrayObject)#1 (1) {
["storage":"ArrayObject":private]=>
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
}
Function Calls
None |
Stats
MD5 | ae834c48186e19d1a0f7fa8bb565fa7a |
Eval Count | 0 |
Decode Time | 84 ms |