From: Aaron Piotrowski Date: Tue, 30 Jun 2015 03:07:29 +0000 (-0500) Subject: Add tests for dynamic static call to instance method X-Git-Tag: php-7.1.0alpha3~25^2~96 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7565a93d84f1ea6723e9d2aeb0e881f46925c84;p=php Add tests for dynamic static call to instance method --- 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