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

1.1     ! misho       1: --TEST--
        !             2: Closure 026: Assigning a closure object to an array in $this
        !             3: --FILE--
        !             4: <?php
        !             5: 
        !             6: class foo {
        !             7:        public function __construct() {
        !             8:                $a =& $this;
        !             9:                
        !            10:                $a->a[] = function() {
        !            11:                        return 1;       
        !            12:                };
        !            13:                
        !            14:                var_dump($this);
        !            15:                
        !            16:                var_dump($this->a[0]());
        !            17:        }
        !            18: }
        !            19: 
        !            20: $x = new foo;
        !            21: 
        !            22: print "--------------\n";
        !            23: 
        !            24: foreach ($x as $b => $c) {
        !            25:        var_dump($b, $c);
        !            26:        var_dump($c[0]());
        !            27: }
        !            28: 
        !            29: ?>
        !            30: --EXPECTF--
        !            31: object(foo)#%d (1) {
        !            32:   ["a"]=>
        !            33:   array(1) {
        !            34:     [0]=>
        !            35:     object(Closure)#%d (0) {
        !            36:     }
        !            37:   }
        !            38: }
        !            39: int(1)
        !            40: --------------
        !            41: string(1) "a"
        !            42: array(1) {
        !            43:   [0]=>
        !            44:   object(Closure)#%d (0) {
        !            45:   }
        !            46: }
        !            47: int(1)

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