|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-01-04 22:46 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 10:00:01 2025 UTC |
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)