php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67222 Parent class static method passes wrong called_scope name to closure
Submitted: 2014-05-06 22:51 UTC Modified: 2014-05-08 18:06 UTC
Votes:2
Avg. Score:2.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: lonny at lonnylot dot com Assigned:
Status: Duplicate Package: Scripting Engine problem
PHP Version: 5.5.12 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lonny at lonnylot dot com
New email:
PHP Version: OS:

 

 [2014-05-06 22:51 UTC] 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"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-08 18:06 UTC] levim@php.net
-Status: Open +Status: Duplicate
 [2014-05-08 18:06 UTC] levim@php.net
This is a duplicate of bug 66622.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 04:01:27 2024 UTC