Bug #67547 [Opn->Nab]: New feature working for undeclared classes
| From: | requinix@php.net | Date: | Mon, 30 Jun 2014 17:01:32 +0000 |
| Subject: | Bug #67547 [Opn->Nab]: New feature working for undeclared classes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186397@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67547&edit=1
ID: 67547
Updated by: requinix@php.net
Reported by: magnusthorek at gmail dot com
Summary: New feature working for undeclared classes
-Status: Open
+Status: Not a bug
Type: Bug
Package: Class/Object related
Operating System: N/A
PHP Version: 5.5.14
Block user comment: N
Private report: N
New Comment:
PHP doesn't actually need the definition of the class to know its fully-qualified name - all
the required information is available at compile-time. So it doesn't try to load it.
Previous Comments:
------------------------------------------------------------------------
[2014-06-30 16:21:39] magnusthorek at gmail dot com
Description:
------------
PHP 5.5 has implemented as a new feature a new way to retrieve the classname through the syntax
::class:
It work ver well as described in "Sample #1" below. But why this syntax also returns a
classname when used alongside an undeclared class, according to "Sample #2"?
In several other cases an error is raised, but not here. Anyone know, with concrete basis if
possible, why does this happen?
Does it have anything to Late Static Bindings or it's just a (temporary) limitation/bug of this
brand new feature?
Test script:
---------------
<?php
// Sample #1
namespace Testing;
class Test{}
echo Test::class; // Testing\Test;
?>
<?php
// Sample #2
echo UndeclaredClass::class; // UndeclaredClass
Expected result:
----------------
For "Sample #1":
Testing\test;
For Sample #2:
Fatal error: Class 'UndeclaredClass'...
Actual result:
--------------
For "Sample #1":
Testing\test;
For Sample #2:
UndeclaredClass
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67547&edit=1