1--TEST--
2Testing 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
18var_dump(call_user_func(array($foo, '__invoke'))->__invoke());
19var_dump(call_user_func(function() use (&$foo) { return $foo; }, '__invoke'));
20
21?>
22--EXPECTF--
23string(3) "OK!"
24object(Closure)#%d (1) {
25  ["static"]=>
26  array(1) {
27    ["instance"]=>
28    object(Closure)#%d (0) {
29    }
30  }
31}
32