Bug #52230 [NEW]: namespace & __autoload clash
| From: | spawn at frostdrake dot tk | Date: | Thu, 01 Jul 2010 23:30:24 +0000 |
| Subject: | Bug #52230 [NEW]: namespace & __autoload clash | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-152021@lists.php.net to get a copy of this message | ||
From:
Operating system: gentoo & ubuntu
PHP version: 5.3.2
Package: Class/Object related
Bug Type: Bug
Bug description:namespace & __autoload clash
Description:
------------
when you use __autoload($var) it will get the class needed depending on the
file.
by using namespace and getting the class by a full path name
ex
new \class\name
__autload will then try to load classname
Test script:
---------------
/** index.php **/
function __autoload($var) {
require_once($var.'.php');
}
//It will try to load the file Coreinit.php and not Core/init.php;
new Core\init
/** Core/init.php **/
namespace Core;
class init{
function __construct(){
echo 'Bingo..!';
}
}
Expected result:
----------------
that autoload loads Core/init.php
Actual result:
--------------
autoload loads Coreinit.php
--
Edit bug report at http://bugs.php.net/bug.php?id=52230&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52230&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52230&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52230&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52230&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52230&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52230&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52230&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52230&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52230&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52230&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52230&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52230&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52230&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52230&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52230&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52230&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52230&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52230&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52230&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52230&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52230&r=mysqlcfg