diff options
| author | Aaron Piotrowski <aaron@trowski.com> | 2015-06-29 22:07:29 -0500 |
|---|---|---|
| committer | Bob Weinand <bobwei9@hotmail.com> | 2015-06-30 07:07:17 +0200 |
| commit | f7565a93d84f1ea6723e9d2aeb0e881f46925c84 (patch) | |
| tree | 8cede0cb6afd6dc91f479a4e774fc601407c89a6 | |
| parent | ffd36e0fc8c91c415a6e10f4f06f39c2508bfe64 (diff) | |
| download | php-git-f7565a93d84f1ea6723e9d2aeb0e881f46925c84.tar.gz | |
Add tests for dynamic static call to instance method
| -rw-r--r-- | Zend/tests/indirect_call_array_005.phpt | 28 | ||||
| -rw-r--r-- | Zend/tests/indirect_call_string_003.phpt | 28 |
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 |
