|  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
 [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-2020 The PHP Group
All rights reserved.
Last updated: Sun Feb 23 17:01:28 2020 UTC