#47001 [Opn->Bgs]: autoload called by class_exists is different than called by new
ID: 47001
Updated by: johannes@php.net
Reported By: pinochet dot pl at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Linux Ubuntu8.10 kernel: 2.6.24
PHP Version: 5.3CVS-2009-01-04 (CVS)
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
class_exists() doesn't do any check of any kind...
Previous Comments:
------------------------------------------------------------------------
[2009-01-04 22:12:43] pinochet dot pl at gmail dot com
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 this bug report at http://bugs.php.net/?id=47001&edit=1
Thread (2 messages)