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; } /* }}} */