ID: 43138
Updated by: [EMAIL PROTECTED]
-Summary: self and parent in variable
Reported By: felipensp at gmail dot com
Status: Open
-Bug Type: Scripting Engine problem
+Bug Type: Feature/Change Request
Operating System: Linux
-PHP Version: 5.3CVS-2007-10-30 (snap)
+PHP Version: 5.3
-Assigned To:
+Assigned To: colder
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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