summaryrefslogtreecommitdiff
path: root/Zend/tests/methods-on-non-objects-array-creation.phpt
diff options
context:
space:
mode:
authorTimm Friebe <thekid@thekid.de>2014-10-05 14:27:21 +0200
committerTjerk Meesters <datibbaw@php.net>2014-10-06 06:08:02 +0800
commit43f3d250f45e095150d12185f9ac8bfaad27d1cc (patch)
tree03bed70bc72c81d2ca24fa92c773185c5857ffdc /Zend/tests/methods-on-non-objects-array-creation.phpt
parent35314a416ac59e6410ec3aa74c98abb2fc9c5077 (diff)
downloadphp-git-43f3d250f45e095150d12185f9ac8bfaad27d1cc.tar.gz
Add tests verifying calls work inside echo, concatenation and array access
Diffstat (limited to 'Zend/tests/methods-on-non-objects-array-creation.phpt')
-rwxr-xr-xZend/tests/methods-on-non-objects-array-creation.phpt35
1 files changed, 35 insertions, 0 deletions
diff --git a/Zend/tests/methods-on-non-objects-array-creation.phpt b/Zend/tests/methods-on-non-objects-array-creation.phpt
new file mode 100755
index 0000000000..74cbb9c179
--- /dev/null
+++ b/Zend/tests/methods-on-non-objects-array-creation.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Catch method calls on non-objects inside array creation
+--FILE--
+<?php
+set_error_handler(function($code, $message) {
+ var_dump($code, $message);
+});
+
+$x= null;
+var_dump([$x->method() => 'OK']);
+var_dump([$x->method(), $x->method(), $x->method()]);
+echo "Alive\n";
+?>
+--EXPECTF--
+int(4096)
+string(%d) "Call to a member function method() on null"
+array(1) {
+ [""]=>
+ string(2) "OK"
+}
+int(4096)
+string(%d) "Call to a member function method() on null"
+int(4096)
+string(%d) "Call to a member function method() on null"
+int(4096)
+string(%d) "Call to a member function method() on null"
+array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+}
+Alive \ No newline at end of file