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

1.1     ! misho       1: --TEST--
        !             2: Testing call_user_func() with closures
        !             3: --FILE--
        !             4: <?php
        !             5: 
        !             6: $foo = function() {
        !             7:        static $instance;
        !             8:        
        !             9:        if (is_null($instance)) {
        !            10:                $instance = function () {
        !            11:                        return 'OK!';
        !            12:                };
        !            13:        }
        !            14:                
        !            15:        return $instance;       
        !            16: };
        !            17: 
        !            18: var_dump(call_user_func(array($foo, '__invoke'))->__invoke());
        !            19: var_dump(call_user_func(function() use (&$foo) { return $foo; }, '__invoke'));
        !            20: 
        !            21: ?>
        !            22: --EXPECTF--
        !            23: %unicode|string%(3) "OK!"
        !            24: object(Closure)#%d (1) {
        !            25:   [%u|b%"static"]=>
        !            26:   array(1) {
        !            27:     [%u|b%"instance"]=>
        !            28:     object(Closure)#%d (0) {
        !            29:     }
        !            30:   }
        !            31: }

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