From f7565a93d84f1ea6723e9d2aeb0e881f46925c84 Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Mon, 29 Jun 2015 22:07:29 -0500 Subject: [PATCH] Add tests for dynamic static call to instance method --- Zend/tests/indirect_call_array_005.phpt | 28 ++++++++++++++++++++++++ Zend/tests/indirect_call_string_003.phpt | 28 ++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 Zend/tests/indirect_call_array_005.phpt create mode 100644 Zend/tests/indirect_call_string_003.phpt 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 +--FILE-- +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 +--FILE-- +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 -- 2.40.0