php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46665 Triggering autoload with a variable classname causes truncated autoload param
Submitted: 2008-11-25 14:45 UTC Modified: 2008-11-25 21:14 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: asonge@php.net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3CVS-2008-11-25 (snap) OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: asonge@php.net
New email:
PHP Version: OS:

 

 [2008-11-25 14:45 UTC] 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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-25 14:56 UTC] asonge@php.net
Changing the category to something more accurate...
 [2008-11-25 19:43 UTC] jani@php.net
Changed category to the correct one.
 [2008-11-25 21:14 UTC] felipe@php.net
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.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 07:01:32 2025 UTC