#43138 [Opn->WFx]: Allow keywords self and parent in dynamic class references
| From: | colder@php.net | Date: | Thu, 01 Nov 2007 21:10:50 +0000 |
| Subject: | #43138 [Opn->WFx]: Allow keywords self and parent in dynamic class references | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-119229@lists.php.net to get a copy of this message | ||
ID: 43138
Updated by: colder@php.net
Reported By: felipensp at gmail dot com
-Status: Open
+Status: Wont fix
Bug Type: Feature/Change Request
Operating System: Linux
PHP Version: 5.3
Assigned To: colder
New Comment:
After some discussions, keywords won't be allowed in dynamic class
references. It will be documented accordingly.
Previous Comments:
------------------------------------------------------------------------
[2007-10-30 20:07:13] colder@php.net
This behavior is consistent with the old one: new $classname is also
available in version prior to 5.3, and works the same way.
self and parent are keywords, not real class names. Hence I reclassify
this report as a feature request.
------------------------------------------------------------------------
[2007-10-30 11:36:02] felipensp at gmail dot com
Description:
------------
'self' and 'parent' don't are evaluated when calling static
member/method with class name in variables.
Reproduce code:
---------------
<?php
class foo {
const foo = 1;
public function __construct() {
$classname = 'parent';
echo $classname::FOO;
// Fatal error: Class 'parent' not found
$classname = 'self';
echo $classname::FOO;
// Fatal error: Class 'self' not found
// new $classname; too
}
}
new foo;
Actual result:
--------------
Fatal error: Class 'parent' not found
and
Fatal error: Class 'self' not found
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43138&edit=1