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 #34548 (Method append() in class extended from ArrayObject crashes PHP) --FIL..
Decoded Output download
--TEST--
Bug #34548 (Method append() in class extended from ArrayObject crashes PHP)
--FILE--
<?php
class Collection extends ArrayObject
{
public function add($dataArray)
{
foreach($dataArray as $value) $this->append($value);
}
public function offsetSet($index, $value): void
{
parent::offsetSet($index, $value);
}
}
$data1=array('one', 'two', 'three');
$data2=array('four', 'five');
$foo=new Collection($data1);
$foo->add($data2);
print_r($foo->getArrayCopy());
echo "Done
";
?>
--EXPECT--
Array
(
[0] => one
[1] => two
[2] => three
[3] => four
[4] => five
)
Done
Did this file decode correctly?
Original Code
--TEST--
Bug #34548 (Method append() in class extended from ArrayObject crashes PHP)
--FILE--
<?php
class Collection extends ArrayObject
{
public function add($dataArray)
{
foreach($dataArray as $value) $this->append($value);
}
public function offsetSet($index, $value): void
{
parent::offsetSet($index, $value);
}
}
$data1=array('one', 'two', 'three');
$data2=array('four', 'five');
$foo=new Collection($data1);
$foo->add($data2);
print_r($foo->getArrayCopy());
echo "Done\n";
?>
--EXPECT--
Array
(
[0] => one
[1] => two
[2] => three
[3] => four
[4] => five
)
Done
Function Calls
None |
Stats
MD5 | 2664dda29bac7e7ced946da76fae51a6 |
Eval Count | 0 |
Decode Time | 87 ms |