com php-src: Fixed bug #70873 (Regression on private static properties access): NEWS Zend/tests/bug70873.phpt Zend/zend_object_han dlers.c
| From: | Xinchen Hui | Date: | Sat, 07 Nov 2015 14:50:36 +0000 |
| Subject: | com php-src: Fixed bug #70873 (Regression on private static properties access): NEWS Zend/tests/bug70873.phpt Zend/zend_object_han dlers.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89634@lists.php.net to get a copy of this message | ||
Commit: 2d8d97cee25b632b21d4740c0c7c077196603e9d
Author: Xinchen Hui <laruence@gmail.com> Sat, 7 Nov 2015 06:50:24 -0800
Parents: c524f43e4f6869854d03e11336ddbccab255887a
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2d8d97cee25b632b21d4740c0c7c077196603e9d
Log:
Fixed bug #70873 (Regression on private static properties access)
Bugs:
https://bugs.php.net/70873
Changed paths:
M NEWS
A Zend/tests/bug70873.phpt
M Zend/zend_object_handlers.c
Diff:
diff --git a/NEWS b/NEWS
index e68dc23..95aab2c 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP NEWS
?? ??? 2015, PHP 7.0.1
- Core:
+ . Fixed bug #70873 (Regression on private static properties access).
+ (Laruence)
. Fixed bug #70805 (Segmentation faults whilst running Drupal 8 test suite).
(Dmitry, Laruence)
. Fixed bug #70862 (Several functions do not check return code of
diff --git a/Zend/tests/bug70873.phpt b/Zend/tests/bug70873.phpt
new file mode 100644
index 0000000..3edb7ea
--- /dev/null
+++ b/Zend/tests/bug70873.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #70873 (Regression on private static properties access)
+--FILE--
+<?php
+
+class A {
+ private static $x = 1;
+}
+
+class B extends A {
+ function bar() {
+ var_dump(self::$x);
+ }
+};
+
+class C extends A {
+ function bar() {
+ var_dump(A::$x);
+ }
+};
+
+
+$a = new B;
+$a->bar();
+
+$b = new C;
+$b->bar();
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Cannot access property B::$x in %sbug70873.php:%d
+Stack trace:
+#0 %sbug70873.php(%d): B->bar()
+#1 {main}
+ thrown in %sbug70873.php on line %d
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 7c4b6a6..4cd8a4e 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -275,10 +275,10 @@ static zend_always_inline int zend_verify_property_access(zend_property_info
*pr
return 1;
} else if (property_info->flags & ZEND_ACC_PRIVATE) {
return (ce == EG(scope) || property_info->ce == EG(scope));
- } else {
- ZEND_ASSERT(property_info->flags & ZEND_ACC_PROTECTED);
+ } else if (property_info->flags & ZEND_ACC_PROTECTED) {
return zend_check_protected(property_info->ce, EG(scope));
}
+ return 0;
}
/* }}} */