com php-src: Add additional protected visibility prototype test: Zend/tests/grandparent_prototype.phpt
| From: | Nikita Popov | Date: | Thu, 28 Mar 2019 09:14:58 +0000 |
| Subject: | com php-src: Add additional protected visibility prototype test: Zend/tests/grandparent_prototype.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105381@lists.php.net to get a copy of this message | ||
Commit: d9fbbbc868e7dda70e3a442f4c300ba46ddf449c
Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 28 Mar 2019 10:14:14 +0100
Parents: 7f72d771e8581bfff7856b46ae9fb8555b061118
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d9fbbbc868e7dda70e3a442f4c300ba46ddf449c
Log:
Add additional protected visibility prototype test
See https://github.com/php/php-src/pull/3993
for context.
Changed paths:
A Zend/tests/grandparent_prototype.phpt
Diff:
diff --git a/Zend/tests/grandparent_prototype.phpt b/Zend/tests/grandparent_prototype.phpt
new file mode 100644
index 0000000..8729696
--- /dev/null
+++ b/Zend/tests/grandparent_prototype.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Protected visibility test case with a grandparent prototype
+--FILE--
+<?php
+
+class A {
+ protected function test() {}
+}
+class B extends A {
+ public function test2($x) {
+ $x->test(); // Uncaught Error: Call to protected method D::test() from context
'B'
+ }
+}
+class C extends A {
+ protected function test() {}
+}
+class D extends C {
+ protected function test() {
+ echo "Hello World!\n";
+ }
+}
+(new B)->test2(new D);
+
+?>
+--EXPECT--
+Hello World!