Bug #66252 [Asn->Csd]: Problems in AST evaluation invalidating valid parent:: reference

From: Date: Tue, 10 Dec 2013 10:21:52 +0000
Subject: Bug #66252 [Asn->Csd]: Problems in AST evaluation invalidating valid parent:: reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183219@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66252&edit=1 ID: 66252 Updated by: dmitry@php.net Reported by: Terry at ellisons dot org dot uk Summary: Problems in AST evaluation invalidating valid parent:: reference -Status: Assigned +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: N/A PHP Version: master-Git-2013-12-10 (Git) Assigned To: dmitry Block user comment: N Private report: N New Comment: Automatic comment on behalf of dmitry@zend.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=5a87b7ff39bbf427807c46d1e51e2654259ad394 Log: Fixed bug #66252 (Problems in AST evaluation invalidating valid parent:: reference. Constant expessions have to be evaluated in context of defining class). Previous Comments: ------------------------------------------------------------------------ [2013-12-10 08:55:05] laruence@php.net thanks for spotting this and explained the reason. ------------------------------------------------------------------------ [2013-12-10 02:00:38] Terry at ellisons dot org dot uk Description: ------------ zval_update_constant_ex() evaluates a constant within the scope a class when executed within a class scope. The new code to support ASTs does not pass this context into the AST evaluator so the class context is lost and references to self::SOME_CONSTANT and parent::SOME_CONSTANT error. Test script: --------------- --TEST-- Terry_002 Problems in AST evaluation invalidating valid parent:: reference --INI-- opcache.enable=0 opcache.enable_cli=0 opcache.optimization_level=0 --SKIPIF-- --FILE-- <?php class A { const HW = "this is A"; } class B extends A { const BHW = parent::HW . " extended by B"; } const C = B::BHW; echo C, "\n"; --CLEAN-- --EXPECT-- this is A extended by B ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66252&edit=1

« previous php.bugs (#183219) next »