com php-src: Add tests for dynamic static call to instance method: Zend/tests/indirect_call_array_005.phpt Zend/te sts/indirect_call_string_003.phpt

From: Date: Tue, 30 Jun 2015 05:07:17 +0000
Subject: com php-src: Add tests for dynamic static call to instance method: Zend/tests/indirect_call_array_005.phpt Zend/te sts/indirect_call_string_003.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87641@lists.php.net to get a copy of this message
Commit: f7565a93d84f1ea6723e9d2aeb0e881f46925c84 Author: Aaron Piotrowski <aaron@trowski.com> Mon, 29 Jun 2015 22:07:29 -0500 Committer: Bob Weinand <bobwei9@hotmail.com> Tue, 30 Jun 2015 07:07:17 +0200 Parents: ffd36e0fc8c91c415a6e10f4f06f39c2508bfe64 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f7565a93d84f1ea6723e9d2aeb0e881f46925c84 Log: Add tests for dynamic static call to instance method Changed paths: A Zend/tests/indirect_call_array_005.phpt A Zend/tests/indirect_call_string_003.phpt Diff: diff --git a/Zend/tests/indirect_call_array_005.phpt b/Zend/tests/indirect_call_array_005.phpt new file mode 100644 index 0000000..4938856 --- /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 0000000..a6839df --- /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

« previous php.cvs (#87641) next »