|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76853 ::class blindly returns whatever string precedes it, even if clas doesn't exist
Submitted: 2018-09-09 16:15 UTC Modified: 2018-09-09 16:22 UTC
From: teo8976 at gmail dot com Assigned:
Status: Duplicate Package: *General Issues
PHP Version: 7.3.0beta3 OS: all
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: teo8976 at gmail dot com
New email:
PHP Version: OS:


 [2018-09-09 16:15 UTC] teo8976 at gmail dot com
see below

Test script:

echo \skljnsdkf\olsjdnvsjd::class;

Expected result:
Fatal error: Uncaught Error: Class 'skljnsdkf\olsjdnvsjd' not found

Actual result:
outputs this:

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:

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:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-09-09 16:22 UTC]
-Status: Open +Status: Duplicate
 [2018-09-09 16:22 UTC]
Dupe of #67973
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon May 10 22:01:24 2021 UTC