#44782 [Opn->Ver]: Problem with namespace and dynamic referencing
| From: | colder@php.net | Date: | Sat, 19 Apr 2008 21:43:27 +0000 |
| Subject: | #44782 [Opn->Ver]: Problem with namespace and dynamic referencing | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-124379@lists.php.net to get a copy of this message | ||
ID: 44782
Updated by: colder@php.net
-Summary: Problem with namespace / late static binding
Reported By: deleet at sapo dot pt
-Status: Open
+Status: Verified
Bug Type: Class/Object related
Operating System: Fedora 6
PHP Version: 5.3CVS-2008-04-19 (snap)
New Comment:
This isn't late static bindings, but it's indeed a bug, probably
relying on the fact that Testing::$func(); would have been rewritten in
compile time.
Previous Comments:
------------------------------------------------------------------------
[2008-04-19 18:34:31] deleet at sapo dot pt
Description:
------------
Possible problem with the implementation of namespaces and late static
binding.
Reproduce code:
---------------
<?php
namespace Something;
class Testing {
function __construct() {
}
static function stuff() {
echo 'I work!' . "<br />\n";
}
}
Testing::stuff();
$var = 'Testing'; $func = 'stuff';
// No effect: use Something;
$var::$func();
?>
Expected result:
----------------
Output:
------------------
I work!
I work!
Actual result:
--------------
Output:
------------------
I work!
Fatal error: Class 'Testing' not found in //file url// on line 20
------------------
PHP is not looking for the class inside the defined namespace when
using late static binding. It works if I use $var =
'Something::Testing'; but that's not indented behaviour. Also, using the
namespace seems to have no effect.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44782&edit=1