Bug #76860 [Csd]: Missed "Accessing static property as non static" warning

From: Date: Tue, 11 Sep 2018 13:20:22 +0000
Subject: Bug #76860 [Csd]: Missed "Accessing static property as non static" warning
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216986@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76860&edit=1 ID: 76860 Updated by: nikic@php.net Reported by: dmitry@php.net Summary: Missed "Accessing static property as non static" warning Status: Closed Type: Bug Package: *General Issues Operating System: * PHP Version: master-Git-2018-09-11 (Git) Assigned To: dmitry Block user comment: N Private report: N New Comment: There is now an inconsistency with this case: <?php class A { private static $a = "a"; public function __construct() { var_dump($this->a); } } class B extends A { private static $a = "a"; } new B; ?> We would have to drop this check to make it consistent: https://github.com/php/php-src/blob/master/Zend/zend_object_handlers.c#L434 Previous Comments: ------------------------------------------------------------------------ [2018-09-11 09:11:54] dmitry@php.net Fixed in master ------------------------------------------------------------------------ [2018-09-11 09:06:42] dmitry@php.net Description: ------------ Accessing private static property as non-static may miss warning message. Test script: --------------- <?php class A { private static $a = "a"; public function __construct() { var_dump($this->a); } } class B extends A { } new B; ?> Expected result: ---------------- Notice: Accessing static property B::$a as non static in %s on line %d Notice: Undefined property: B::$a in %s on line %d NULL Actual result: -------------- Notice: Undefined property: B::$a in %s on line %d NULL ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76860&edit=1

« previous php.bugs (#216986) next »