com php-src: Fixed bug #70873 (Regression on private static properties access): Zend/tests/bug70873.phpt Zend/zend_object_handlers .c

From: Date: Sun, 08 Nov 2015 05:36:40 +0000
Subject: com php-src: Fixed bug #70873 (Regression on private static properties access): Zend/tests/bug70873.phpt Zend/zend_object_handlers .c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-89667@lists.php.net to get a copy of this message
Commit: 10cd3b69f835d03af340f1b8d78e878820033d17 Author: Xinchen Hui <laruence@gmail.com> Sat, 7 Nov 2015 06:50:24 -0800 Committer: Anatol Belski <ab@php.net> Sun, 8 Nov 2015 06:36:40 +0100 Parents: 36e35b9a235abb793f50955d94c5e0e5545828b4 Branches: PHP-7.0.0 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=10cd3b69f835d03af340f1b8d78e878820033d17 Log: Fixed bug #70873 (Regression on private static properties access) Bugs: https://bugs.php.net/70873 Changed paths: A Zend/tests/bug70873.phpt M Zend/zend_object_handlers.c Diff: 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; } /* }}} */

« previous php.cvs (#89667) next »