Bug #72240 [Opn->Dup]: self in anonymous function indicates inherited class
Edit report at https://bugs.php.net/bug.php?id=72240&edit=1
ID: 72240
Updated by: requinix@php.net
Reported by: dqneoo at gmail dot com
Summary: self in anonymous function indicates inherited class
-Status: Open
+Status: Duplicate
Type: Bug
Package: *General Issues
PHP Version: 5.6.21
Block user comment: N
Private report: N
New Comment:
Duplicate of bug #69568 which apparently says this could only be fixed for PHP 7.
Previous Comments:
------------------------------------------------------------------------
[2016-05-19 02:52:38] dqneoo at gmail dot com
Description:
------------
"self" in anonymous function indicates child class, behaving the same way as
"static"
Test script:
---------------
class A
{
public static function func()
{
return function () {
return new self();
};
}
}
class B extends A {}
$b = B::func();
echo get_class($b());
Expected result:
----------------
A
Actual result:
--------------
B
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72240&edit=1
Thread (2 messages)