Annotation of embedaddon/php/ext/spl/tests/bug34548.phpt, revision 1.1.1.1

1.1       misho       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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>