|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #71678 class() extends self
Submitted: 2016-02-27 17:08 UTC Modified: 2017-08-05 04:37 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: php at thekid dot de Assigned:
Status: Suspended Package: Scripting Engine problem
PHP Version: 7.0.3 OS: Windows
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-02-27 17:08 UTC] php at thekid dot de
Anonymous class syntax doesn't work with "self" keyword.

Test script:
class T {
  static function new() {
    return new class() extends self { };

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


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-02-27 17:09 UTC]
Same goes for "parent"
 [2016-07-14 09:44 UTC]
-Status: Open +Status: Assigned -Type: Bug +Type: Feature/Change Request -Assigned To: +Assigned To: krakjoe
 [2016-07-14 09:44 UTC]
This is not a bug, but a feature request.
 [2017-01-29 07:33 UTC]
-Assigned To: krakjoe +Assigned To:
 [2017-01-29 07:33 UTC]
For this kind of change, an RFC is required.

Please see
 [2017-08-05 04:37 UTC]
-Status: Open +Status: Suspended
 [2017-08-05 04:37 UTC]
Thank you for your interest in PHP and for submitting a feature request. Please be aware that due to the magnitude of change this request requires, it would be necessary to discuss it on PHP Internals list ( as an RFC. Please read the guide about creating RFCs here:
If you haven't had experience with writing RFCs before, it is advised to seek guidance on the Internals list ( and/or solicit help from one of the experienced developers. 

Please to not consider this comment as a negative view on the merits of your proposal - every proposal which requires changes of certain magnitude, even the very successful and widely supported ones, must be done through the RFC process. This helps make the process predictable, transparent and accessible to all developers.
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC