php.net |  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
Votes:1
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php at thekid dot de
New email:
PHP Version: OS:

 

 [2016-02-27 17:08 UTC] 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

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

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

Please see http://wiki.php.net/rfc/howto
 [2017-08-05 04:37 UTC] stas@php.net
-Status: Open +Status: Suspended
 [2017-08-05 04:37 UTC] stas@php.net
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 (internals@lists.php.net) as an RFC. Please read the guide about creating RFCs here:
https://wiki.php.net/rfc/howto
If you haven't had experience with writing RFCs before, it is advised to seek guidance on the Internals list (http://php.net/mailing-lists.php) 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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 10:01:28 2024 UTC