php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48955 different namespace passing to autoloader
Submitted: 2009-07-17 09:53 UTC Modified: 2009-07-24 17:43 UTC
Votes:4
Avg. Score:4.5 ± 0.9
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:4 (100.0%)
From: schunke at gmx dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3.0 OS: *
Private report: No CVE-ID: None
 [2009-07-17 09:53 UTC] schunke at gmx dot net
Description:
------------
Theres a difference in namespace passing to an autoloader. That may 
cause several problems and it should be the same.

Reproduce code:
---------------
<?php
  function __autoload($value) {
    echo $value;
  }
  
  new \ns\className;
  
  $a = "\ns\className";
  new $a;
?>

Expected result:
----------------
Same passing of namespace to autoloader as

new \ns\className  ->  ns\className
and
$a = "\ns\className";
new $a;  ->  ns\className

Actual result:
--------------
new \ns\className  ->  autoloader gets ns\className

$a = "\ns\className";
new $a;                -> autoloader gets \ns\className  (the first 
backslash is the problem)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-24 09:25 UTC] jani@php.net
\n inside double quotes is escape char of newline. No bug here.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 08 20:01:34 2025 UTC