diff options
Diffstat (limited to 'Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt')
-rwxr-xr-x | Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt b/Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt new file mode 100755 index 0000000000..56819e05d2 --- /dev/null +++ b/Zend/tests/methods-on-non-objects-nested-calls-dyn.phpt @@ -0,0 +1,33 @@ +--TEST-- +Catch method calls on non-objects with nested dynamic calls +--FILE-- +<?php +function nested() { + throw new LogicException('Should not be called'); +} +set_error_handler(function($code, $message) { + static $i= 0; + echo 'Called #'.(++$i)."\n"; +}); + +$x= null; + +$closure= function() { return nested(); }; +var_dump($x->method($closure())); + +$lambda= create_function('', 'return nested();'); +var_dump($x->method($lambda())); + +$func= 'nested'; +var_dump($x->method($func())); + +echo "Alive\n"; +?> +--EXPECTF-- +Called #1 +NULL +Called #2 +NULL +Called #3 +NULL +Alive |