summaryrefslogtreecommitdiff
path: root/Zend/tests/methods-on-non-objects-as-arg.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/methods-on-non-objects-as-arg.phpt')
-rwxr-xr-xZend/tests/methods-on-non-objects-as-arg.phpt47
1 files changed, 47 insertions, 0 deletions
diff --git a/Zend/tests/methods-on-non-objects-as-arg.phpt b/Zend/tests/methods-on-non-objects-as-arg.phpt
new file mode 100755
index 0000000000..13b83cb06e
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-as-arg.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Catch method calls on non-objects as argument
+--FILE--
+<?php
+function nesting() {
+ return func_get_args();
+}
+set_error_handler(function($code, $message) {
+ static $i= 0;
+ echo 'Called #'.(++$i)."\n";
+});
+
+$x= null;
+var_dump(nesting($x->method()));
+var_dump(nesting(nesting($x->method())));
+var_dump(nesting($x->method(nesting($x->method()))));
+var_dump(nesting($x->method(), $x->method()));
+echo "Alive\n";
+?>
+--EXPECTF--
+Called #1
+array(1) {
+ [0]=>
+ NULL
+}
+Called #2
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+Called #3
+array(1) {
+ [0]=>
+ NULL
+}
+Called #4
+Called #5
+array(2) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+}
+Alive