#44782 [Ver]: Problem with namespace and dynamic referencing

From: Date: Sat, 19 Apr 2008 22:14:16 +0000
Subject: #44782 [Ver]: Problem with namespace and dynamic referencing
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-124380@lists.php.net to get a copy of this message
ID: 44782 User updated by: deleet at sapo dot pt Reported By: deleet at sapo dot pt Status: Verified Bug Type: Class/Object related Operating System: Fedora 6 PHP Version: 5.3CVS-2008-04-19 (snap) New Comment: Very well, dynamic referencing it is then :) Thank you for the quick reply, is it possible to get an ETA on the fix? Previous Comments: ------------------------------------------------------------------------ [2008-04-19 21:43:26] colder@php.net 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#124380) next »