#46665 [Opn->Csd]: Triggering autoload with a variable classname causes truncated autoload param
| From: | felipe@php.net | Date: | Tue, 25 Nov 2008 21:14:37 +0000 |
| Subject: | #46665 [Opn->Csd]: Triggering autoload with a variable classname causes truncated autoload param | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-131323@lists.php.net to get a copy of this message | ||
ID: 46665
Updated by: felipe@php.net
Reported By: asonge@php.net
-Status: Open
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5.3CVS-2008-11-25 (snap)
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2008-11-25 19:43:45] jani@php.net
Changed category to the correct one.
------------------------------------------------------------------------
[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