Bug #71678 [Opn]: class() extends self
| From: | thekid@php.net | Date: | Sat, 27 Feb 2016 17:09:56 +0000 |
| Subject: | Bug #71678 [Opn]: class() extends self | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-199503@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71678&edit=1
ID: 71678
Updated by: thekid@php.net
Reported by: php at thekid dot de
Summary: class() extends self
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: Windows
PHP Version: 7.0.3
Block user comment: N
Private report: N
New Comment:
Same goes for "parent"
Previous Comments:
------------------------------------------------------------------------
[2016-02-27 17:08:13] php at thekid dot de
Description:
------------
Anonymous class syntax doesn't work with "self" keyword.
Test script:
---------------
class T {
static function new() {
return new class() extends self { };
}
}
var_dump(T::new());
Expected result:
----------------
object(class@anonymous)#1 (0) {
}
Actual result:
--------------
Fatal error: Cannot use 'self' as class name as it is reserved in Command line code on
line 1
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71678&edit=1