Bug #65419 [Ver]: Inside trait, self::class != __CLASS__
| From: | jpauli@php.net | Date: | Wed, 29 Oct 2014 13:40:19 +0000 |
| Subject: | Bug #65419 [Ver]: Inside trait, self::class != __CLASS__ | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188359@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65419&edit=1
ID: 65419
Updated by: jpauli@php.net
Reported by: nicolas dot grekas+php at gmail dot com
Summary: Inside trait, self::class != __CLASS__
Status: Verified
Type: Bug
Package: Scripting Engine problem
PHP Version: 5.5.1
Assigned To: ralphschindler
Block user comment: N
Private report: N
New Comment:
Got a patch at https://github.com/jpauli/php-src/compare/65419
I basically add a runtime resolve for self:: into Traits, making it behaves like __CLASS__
Previous Comments:
------------------------------------------------------------------------
[2014-02-18 08:34:13] nicolas dot grekas+php at gmail dot com
It would be nice if this could be resolved for 5.6. I fear people could start relying on this buggy
behavior...
------------------------------------------------------------------------
[2013-09-12 16:52:28] ralphschindler@php.net
Ill work up a patch that will demonstrate ::class resolving in traits similar to how __CLASS__ works
in traits.
This seems to be the consensus (correct me if I am wrong), and consistent with __CLASS__ (to some
degree) in traits.
------------------------------------------------------------------------
[2013-08-14 10:10:48] nicolas dot grekas+php at gmail dot com
Why remove ::class support inside traits? It mostly works today, and it is as usefull there than
inside classes or anywhere else, am I wrong?
Would it be possible to replace self::class occurences by __CLASS__ at compile time so that the code
path for __CLASS__ is also used here?
------------------------------------------------------------------------
[2013-08-11 15:31:06] laruence@php.net
I prefer to trigger a COMPILE ERROR prevent from using ::class in a traits
------------------------------------------------------------------------
[2013-08-09 07:57:41] gron@php.net
Yes, that looks wrong. It should indeed behave as __CLASS__.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=65419
--
Edit this bug report at https://bugs.php.net/bug.php?id=65419&edit=1