Re: autoloading and undefined class constants
| From: | Alexey Zakhlestin | Date: | Mon, 06 Jul 2009 07:23:00 +0000 |
| Subject: | Re: autoloading and undefined class constants | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-44718@lists.php.net to get a copy of this message | ||
On Mon, Jul 6, 2009 at 6:49 AM, Ben Bidner<ben@vuetec.com> wrote:
> <?php
>
> function autoloader($className)
> {
> throw new Exception("Fail");
> }
>
> spl_autoload_register("autoloader");
The whole point of spl_autoload_register() is to allow programmers to
have several independent autoloaders. So, it is a bad practice to
throw exception from autoload — doing so, you forbid system to try the
next autoloader.
Good practice is: if you can't load class from autoloader — just
silently return from it
--
Alexey Zakhlestin
http://www.milkfarmsoft.com/