Bug #76853 [Opn->Dup]: ::class blindly returns whatever string precedes it, even if clas doesn't exist
| From: | peehaa@php.net | Date: | Sun, 09 Sep 2018 16:22:58 +0000 |
| Subject: | Bug #76853 [Opn->Dup]: ::class blindly returns whatever string precedes it, even if clas doesn't exist | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-216948@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76853&edit=1
ID: 76853
Updated by: peehaa@php.net
Reported by: teo8976 at gmail dot com
Summary: ::class blindly returns whatever string precedes it,
even if clas doesn't exist
-Status: Open
+Status: Duplicate
Type: Bug
Package: *General Issues
Operating System: all
PHP Version: 7.3.0beta3
Block user comment: N
Private report: N
New Comment:
Dupe of #67973
Previous Comments:
------------------------------------------------------------------------
[2018-09-09 16:15:18] teo8976 at gmail dot com
Description:
------------
see below
Test script:
---------------
<?php
echo \skljnsdkf\olsjdnvsjd::class;
Expected result:
----------------
Fatal error: Uncaught Error: Class 'skljnsdkf\olsjdnvsjd' not found
Actual result:
--------------
outputs this:
\skljnsdkf\olsjdnvsjd
as if the class existed.
Not only is this wrong, it is not even documented.
The documentation about "::class" is pathetic. It's not easy to find in the first
place; all I could find is here:
http://be2.php.net/manual/en/language.oop5.constants.php
"""
The special ::class constant are [sic] available as of PHP 5.5.0, and allows for fully qualified
class name resolution at compile [time??], this is useful for namespaced classes:
"""
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76853&edit=1