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

1.1     ! misho       1: --TEST--
        !             2: Testing array dereferencing on return of a method with and without reference
        !             3: --FILE--
        !             4: <?php
        !             5: 
        !             6: class foo {
        !             7:        static $x = array();
        !             8:        
        !             9:        public function &a() {
        !            10:                self::$x = array(1, 2, 3);
        !            11:                return self::$x;
        !            12:        }
        !            13:        
        !            14:        public function b() {
        !            15:                $x = array(1);
        !            16:                $x[] = 2;
        !            17:                return $x;
        !            18:        }
        !            19: }
        !            20: 
        !            21: $foo = new foo;
        !            22: 
        !            23: // Changing the static variable
        !            24: $foo->a()[0] = 2;
        !            25: var_dump($foo::$x);
        !            26: 
        !            27: $foo->b()[] = new stdClass;
        !            28: 
        !            29: $h = $foo->b();
        !            30: var_dump($h);
        !            31: 
        !            32: $h[0] = 3;
        !            33: var_dump($h);
        !            34: 
        !            35: ?>
        !            36: --EXPECT--
        !            37: array(3) {
        !            38:   [0]=>
        !            39:   int(2)
        !            40:   [1]=>
        !            41:   int(2)
        !            42:   [2]=>
        !            43:   int(3)
        !            44: }
        !            45: array(2) {
        !            46:   [0]=>
        !            47:   int(1)
        !            48:   [1]=>
        !            49:   int(2)
        !            50: }
        !            51: array(2) {
        !            52:   [0]=>
        !            53:   int(3)
        !            54:   [1]=>
        !            55:   int(2)
        !            56: }

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