Bug #67222 [Opn->Dup]: Parent class static method passes wrong called_scope name to closure

From: Date: Thu, 08 May 2014 18:06:46 +0000
Subject: Bug #67222 [Opn->Dup]: Parent class static method passes wrong called_scope name to closure
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185729@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67222&edit=1 ID: 67222 Updated by: levim@php.net Reported by: lonny at lonnylot dot com Summary: Parent class static method passes wrong called_scope name to closure -Status: Open +Status: Duplicate Type: Bug Package: Scripting Engine problem PHP Version: 5.5.12 Block user comment: N Private report: N New Comment: This is a duplicate of bug 66622. Previous Comments: ------------------------------------------------------------------------ [2014-05-06 22:51:35] lonny at lonnylot dot com Description: ------------ When a parent class has a static method with a closure in it is passes the wrong called_scope name (via self, static, get_called_class()) to the closure. Test script: --------------- <?php class Foo { public static function blah() { $foo = function(){ var_dump(get_called_class()); }; $foo(); } } class Bar extends Foo { } Bar::blah(); Expected result: ---------------- string(3) "Bar" Actual result: -------------- string(3) "Foo" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67222&edit=1

« previous php.bugs (#185729) next »