summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xZend/tests/methods-on-non-objects-nested-calls-nonct.phpt43
-rwxr-xr-xZend/tests/methods-on-non-objects-nested.inc4
2 files changed, 47 insertions, 0 deletions
diff --git a/Zend/tests/methods-on-non-objects-nested-calls-nonct.phpt b/Zend/tests/methods-on-non-objects-nested-calls-nonct.phpt
new file mode 100755
index 0000000000..a4529eecdc
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-nested-calls-nonct.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Catch method calls on non-objects with nested non-compile-time-resolveable calls
+--FILE--
+<?php
+require('methods-on-non-objects-nested.inc');
+
+set_error_handler(function($code, $message) {
+ static $i= 0;
+ echo 'Called #'.(++$i)."\n";
+});
+
+$x= null;
+
+var_dump($x->method(nested()));
+
+$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()));
+
+var_dump($x->method(call_user_func('nested')));
+var_dump($x->method(call_user_func_array('nested', [])));
+
+echo "Alive\n";
+?>
+--EXPECTF--
+Called #1
+NULL
+Called #2
+NULL
+Called #3
+NULL
+Called #4
+NULL
+Called #5
+NULL
+Called #6
+NULL
+Alive
diff --git a/Zend/tests/methods-on-non-objects-nested.inc b/Zend/tests/methods-on-non-objects-nested.inc
new file mode 100755
index 0000000000..8511414b82
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-nested.inc
@@ -0,0 +1,4 @@
+<?php
+function nested() {
+ throw new LogicException('Should not be called');
+} \ No newline at end of file