php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70159 __CLASS__ is lost in closures declared in classes
Submitted: 2015-07-28 14:28 UTC Modified: 2015-07-28 16:15 UTC
From: jpauli@php.net Assigned: bwoebi
Status: Closed Package: Scripting Engine problem
PHP Version: 7.0.0beta2 OS: *
Private report: No CVE-ID:
 [2015-07-28 14:28 UTC] jpauli@php.net
Description:
------------
If a closure is declared into a class, using __CLASS__ into this closure returns empty string

Test script:
---------------
class Foo
{
    public function bar() {
        return function () { var_dump(__CLASS__); };
    }
}

(new Foo)->bar()();

Expected result:
----------------
"Foo"

Actual result:
--------------
""

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-28 14:31 UTC] jpauli@php.net
-Status: Open +Status: Feedback
 [2015-07-28 14:31 UTC] jpauli@php.net
Please try using this snapshot:

  http://snaps.php.net/php-trunk-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

Fixed. Will be part of PHP7.0beta3
 [2015-07-28 16:15 UTC] bwoebi@php.net
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: bwoebi
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Apr 30 18:01:35 2017 UTC