#46665 [Opn]: Triggering autoload with a variable classname causes truncated autoload param

From: Date: Tue, 25 Nov 2008 19:43:46 +0000
Subject: #46665 [Opn]: Triggering autoload with a variable classname causes truncated autoload param
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-131317@lists.php.net to get a copy of this message
 ID:               46665
 Updated by:       jani@php.net
 Reported By:      asonge@php.net
 Status:           Open
-Bug Type:         *General Issues
+Bug Type:         Scripting Engine problem
 Operating System: *
 PHP Version:      5.3CVS-2008-11-25 (snap)
 New Comment:

Changed category to the correct one.


Previous Comments:
------------------------------------------------------------------------

[2008-11-25 14:56:29] asonge@php.net

Changing the category to something more accurate...

------------------------------------------------------------------------

[2008-11-25 14:45:15] asonge@php.net

Description:
------------
Using a variable to instantiate a namespaced class (eg, new $foo();)
causes truncated data to be passed to the autoloader when the class is
prepended with \.

Reproduce code:
---------------
<?php
// File 1
$baz = '\\Foo\\Bar\\Baz';
new $baz();
function __autoload($class) {
    var_dump($class);
    require './test.php';
}
?>
<?php
// File 2
namespace Foo\Bar;
class Baz {
}
?>

Expected result:
----------------
Foo\Bar\Baz or \Foo\Bar\Baz in the var_dump

Actual result:
--------------
\Foo\Bar\Ba (missing the z)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=46665&edit=1



Thread (4 messages)

« previous php.bugs (#131317) next »