summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/tests/indirect_call_array_005.phpt28
-rw-r--r--Zend/tests/indirect_call_string_003.phpt28
2 files changed, 56 insertions, 0 deletions
diff --git a/Zend/tests/indirect_call_array_005.phpt b/Zend/tests/indirect_call_array_005.phpt
new file mode 100644
index 0000000000..4938856ed2
--- /dev/null
+++ b/Zend/tests/indirect_call_array_005.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Dynamic static call to instance method should throw.
+--CREDITS--
+Aaron Piotrowski <aaron@icicle.io>
+--FILE--
+<?php
+class TestClass
+{
+ private $test;
+
+ public function method()
+ {
+ $this->test = 'test';
+ return "Hello, world!\n";
+ }
+}
+
+$callback = ['TestClass', 'method'];
+echo $callback();
+?>
+--EXPECTF--
+Deprecated: Non-static method TestClass::method() should not be called statically in %s on line %d
+
+Fatal error: Uncaught Error: Using $this when not in object context in %s:%d
+Stack trace:
+#0 %s(%d): TestClass::method()
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/tests/indirect_call_string_003.phpt b/Zend/tests/indirect_call_string_003.phpt
new file mode 100644
index 0000000000..a6839df8a7
--- /dev/null
+++ b/Zend/tests/indirect_call_string_003.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Dynamic static call to instance method should throw.
+--CREDITS--
+Aaron Piotrowski <aaron@icicle.io>
+--FILE--
+<?php
+class TestClass
+{
+ private $test;
+
+ public function method()
+ {
+ $this->test = 'test';
+ return "Hello, world!\n";
+ }
+}
+
+$callback = 'TestClass::method';
+echo $callback();
+?>
+--EXPECTF--
+Deprecated: Non-static method TestClass::method() should not be called statically in %s on line %d
+
+Fatal error: Uncaught Error: Using $this when not in object context in %s:%d
+Stack trace:
+#0 %s(%d): TestClass::method()
+#1 {main}
+ thrown in %s on line %d