From: pinochet dot pl at gmail dot com
Operating system: Linux Ubuntu8.10 kernel: 2.6.24
PHP version: 5.3CVS-2009-01-04 (CVS)
PHP Bug Type: Class/Object related
Bug description: autoload called by class_exists is different than called by
new
Description:
------------
There is namespace: jjroman_net when I call
class_exist('\\jjroman_net\\MyClass'); the parameter of __autoload is
`\jjroman_net\MyClass`
When I just type: new MyClass the parameter of __autoload is
`jjroman_net\MyClass`
Reproduce code:
---------------
index1.php:
<?php
function __autoload($name) {
var_dump($name);
//require($name.'.php');
}
class_exists('\\jjroman_net\\MyClass');
?>
index2.php
<?php
function __autoload($name) {
var_dump($name);
//require($name.'.php');
}
$a = new \jjroman_net\MyClass.php;
?>
Expected result:
----------------
I expected unified way to call __autoload it's not matter if it will be
\jjroman_net\MyClass or without the first slash but I don't like to push IF
in autoload
Actual result:
--------------
index1.php: string(20) "\jjroman_net\MyClass"
index2.php: string(19) "jjroman_net\MyClass"
(and fatal error ofcourse)
--
Edit bug report at http://bugs.php.net/?id=47001&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=47001&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=47001&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=47001&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=47001&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=47001&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=47001&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=47001&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=47001&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=47001&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=47001&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=47001&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=47001&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=47001&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=47001&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47001&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47001&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=47001&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=47001&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=47001&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=47001&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=47001&r=mysqlcfg