Req #64871 [NEW]: The ::class operator should verify the class name
| From: | vrana@php.net | Date: | Fri, 17 May 2013 16:48:43 +0000 |
| Subject: | Req #64871 [NEW]: The ::class operator should verify the class name | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-178994@lists.php.net to get a copy of this message | ||
From: vrana@php.net
Operating system: Any
PHP version: 5.5.0RC1
Package: Class/Object related
Bug Type: Feature/Change Request
Bug description:The ::class operator should verify the class name
Description:
------------
One of the main advantages of the ::class operator could be that it
verifies the class name upon creating the string instead of upon usage. It
should trigger autoloading if the class doesn't exist.
I know that it's somewhat late to change this in PHP 5.5 but I was really
surprised by the lack of this feature and about the fact that it wasn't
considered in RFC.
Test script:
---------------
<?php
// I want to know about this typo.
echo stdClas::class;
Expected result:
----------------
Fatal error: Class 'stdClas' not found
Actual result:
--------------
stdClas
--
Edit bug report at https://bugs.php.net/bug.php?id=64871&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64871&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64871&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64871&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64871&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64871&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64871&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64871&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64871&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64871&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64871&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=64871&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=64871&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64871&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64871&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64871&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64871&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64871&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64871&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64871&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64871&r=mysqlcfg