Skip to content

Commit c6e6b44

Browse files
committed
MF5.0: add new test
1 parent b45944a commit c6e6b44

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

ext/spl/tests/bug34548.phpt

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
--TEST--
2+
bug #34548 (Method append() in class extended from ArrayObject crashes PHP)
3+
--FILE--
4+
<?php
5+
6+
class Collection extends ArrayObject
7+
{
8+
public function add($dataArray)
9+
{
10+
foreach($dataArray as $value) $this->append($value);
11+
}
12+
13+
public function offsetSet($index, $value)
14+
{
15+
parent::offsetSet($index, $value);
16+
}
17+
}
18+
19+
$data1=array('one', 'two', 'three');
20+
$data2=array('four', 'five');
21+
22+
$foo=new Collection($data1);
23+
$foo->add($data2);
24+
25+
print_r($foo->getArrayCopy());
26+
27+
echo "Done\n";
28+
?>
29+
--EXPECT--
30+
Array
31+
(
32+
[0] => one
33+
[1] => two
34+
[2] => three
35+
[3] => four
36+
[4] => five
37+
)
38+
Done

0 commit comments

Comments
 (0)