Bug #65419 [NEW]: Inside trait, self::class != __CLASS__
| From: | nicolas dot grekas+php at gmail dot com | Date: | Thu, 08 Aug 2013 08:44:06 +0000 |
| Subject: | Bug #65419 [NEW]: Inside trait, self::class != __CLASS__ | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-180797@lists.php.net to get a copy of this message | ||
From: nicolas dot grekas+php at gmail dot com
Operating system:
PHP version: 5.5.1
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Inside trait, self::class != __CLASS__
Description:
------------
The RFC for ::class name resolution as scalar say that self::class resolves
the same as __CLASS__:
https://wiki.php.net/rfc/class_name_scalars#considerations
But this is not true when using traits.
Test script:
---------------
<?php
trait abc
{
static function def()
{
echo self::class, "\n";
echo __CLASS__, "\n";
}
class ghi
{
use abc;
}
ghi::def();
Expected result:
----------------
ghi
ghi
Actual result:
--------------
abc
ghi
--
Edit bug report at https://bugs.php.net/bug.php?id=65419&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65419&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65419&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65419&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=65419&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=65419&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65419&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=65419&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=65419&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=65419&r=support
Expected behavior: https://bugs.php.net/fix.php?id=65419&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=65419&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=65419&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=65419&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65419&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=65419&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=65419&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=65419&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65419&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65419&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=65419&r=mysqlcfg