Bug #69007 [Opn->Csd]: scope resolution doesn't work with static anonymous functions

From: Date: Thu, 12 May 2016 16:09:07 +0000
Subject: Bug #69007 [Opn->Csd]: scope resolution doesn't work with static anonymous functions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201047@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69007&edit=1 ID: 69007 Updated by: nikic@php.net Reported by: minecraftshamrock at gmail dot com Summary: scope resolution doesn't work with static anonymous functions -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem PHP Version: master-Git-2015-05-28 (Git) -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: Since PHP 7 the behavior is consistent with HHVM and follows "works the same as outside the closure". Previous Comments: ------------------------------------------------------------------------ [2015-02-07 21:25:51] minecraftshamrock at gmail dot com Description: ------------ Scope resolution using parent:: self:: and static:: does not work properly and is poorly specified for static anonymous functions. Test snippet: http://pastebin.com/7y9Wa4Xj I have neither found a prediction by the specification about how this should behave, nor were I able to interpret any rules into the behavior when testing. I've tested the linked script using http://3v4l.org/ in various versions of PHP and no version of PHP exhibits a logically reasonable behavior (except HHVM). So please specify more exactly how this should behave and implement it in PHP. Expected result: ---------------- Actually none because the specification predicts nothing about this code. Actual result: -------------- Output for 5.5.14 - 5.6.5, php7@20140701 - 20150201 GuyGuy ChildChild FatherFather Child GuyChildChild GuyGuy Note that for this versions "self::hi();" and "echo self::class;" in the static anonymous function do not even refer to the same class as "self". Output for 5.5.0 - 5.5.13, php7@20140507 - 20140521 GuyGuy ChildChild FatherFather Guy GuyGuyGuy FatherFather ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69007&edit=1

« previous php.bugs (#201047) next »