Bug #75912 [NEW]: No name resolution on D::class (even with warnings enabled)
| From: | ejrx7753 at gmail dot com | Date: | Sat, 03 Feb 2018 21:38:35 +0000 |
| Subject: | Bug #75912 [NEW]: No name resolution on D::class (even with warnings enabled) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-213793@lists.php.net to get a copy of this message | ||
From: ejrx7753 at gmail dot com
Operating system: Mac OS, Ubuntu
PHP version: 7.1.14
Package: *General Issues
Bug Type: Bug
Bug description:No name resolution on D::class (even with warnings enabled)
Description:
------------
I'm able to enter any random string of characters and add "::class" and
it will work fine without error. PHP Documentation clearly states that
this ::class feature "allows for fully qualified class name resolution".
It should be a fatal error just as with new C().
Quote: "The special ::class constant are available as of PHP 5.5.0, and
allows for fully qualified class name resolution at compile, this is
useful for namespaced classes:"
(http://php.net/manual/en/language.oop5.constants.php)
Test script:
---------------
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
var_dump(C::class);
var_dump(\D::class);
Expected result:
----------------
Expected a fatal error
Actual result:
--------------
string(1) "C"
string(1) "D"
--
Edit bug report at https://bugs.php.net/bug.php?id=75912&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75912&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75912&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75912&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75912&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75912&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75912&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75912&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75912&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75912&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75912&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75912&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75912&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75912&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75912&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75912&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75912&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75912&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75912&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75912&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75912&r=mysqlcfg