Annotation of embedaddon/php/Zend/tests/dereference_013.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Testing array dereferencing on array returned from __call method
        !             3: --FILE--
        !             4: <?php
        !             5: 
        !             6: error_reporting(E_ALL);
        !             7: 
        !             8: class foo {
        !             9:        public $x = array(2);
        !            10:                
        !            11:        public function __call($x, $y) {
        !            12:                if (count($this->x) == 1) {
        !            13:                        $this->x[] = $y[0];
        !            14:                }
        !            15:                return $this->x;
        !            16:        }
        !            17: }
        !            18: 
        !            19: $foo = new foo;
        !            20: 
        !            21: $x = array(1);
        !            22: 
        !            23: $foo->b($x)[1] = 3;
        !            24: 
        !            25: var_dump($foo->b()[0]);
        !            26: var_dump($foo->b()[1]);
        !            27: var_dump($foo->b()[2]);
        !            28: 
        !            29: ?>
        !            30: --EXPECTF--
        !            31: int(2)
        !            32: array(1) {
        !            33:   [0]=>
        !            34:   int(1)
        !            35: }
        !            36: 
        !            37: Notice: Undefined offset: %d in %s on line %d
        !            38: NULL

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