From: Xinchen Hui Date: Sat, 7 Nov 2015 14:50:24 +0000 (-0800) Subject: Fixed bug #70873 (Regression on private static properties access) X-Git-Tag: php-7.0.1RC1~136 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d8d97cee25b632b21d4740c0c7c077196603e9d;p=php Fixed bug #70873 (Regression on private static properties access) --- diff --git a/NEWS b/NEWS index e68dc23819..95aab2c0c1 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 0000000000..3edb7eac43 --- /dev/null +++ b/Zend/tests/bug70873.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #70873 (Regression on private static properties access) +--FILE-- +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 7c4b6a679a..4cd8a4e7c2 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; } /* }}} */