#47568 [Opn->Bgs]: autoload function with namespace aliasing

From: Date: Tue, 10 Mar 2009 18:12:35 +0000
Subject: #47568 [Opn->Bgs]: autoload function with namespace aliasing
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-134572@lists.php.net to get a copy of this message
ID: 47568 Updated by: scottmac@php.net Reported By: ice dot wynn at gmail dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: windows vista PHP Version: 5.3CVS-2009-03-05 (snap) New Comment: Importing is performed at compile-time, and so does not affect dynamic class, function or constant names. Previous Comments: ------------------------------------------------------------------------ [2009-03-05 05:38:33] ice dot wynn at gmail dot com Description: ------------ The parameter of __autoload() is wrong when using a variable to instantiate a namespaced class with aliasing namespace. Reproduce code: --------------- <?php //file 1 function __autoload($className){ var_dump($className); //require($className.'.php'); exit; } use Foo as Bar; new Bar\SomeClass; ?> <?php //file 2 function __autoload($className){ var_dump($className); //require($className.'.php'); exit; } use Foo as Bar; $class = 'Bar\SomeClass'; new $class; ?> Expected result: ---------------- file 1: string(13) "Foo\SomeClass" file 2: string(13) "Foo\SomeClass" Actual result: -------------- file 1: string(13) "Foo\SomeClass" file 2: string(13) "Bar\SomeClass" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47568&edit=1

« previous php.bugs (#134572) next »