RE : [PHP-DEV] link to exceptions in autoload thread?

From: Date: Wed, 03 Oct 2007 17:21:45 +0000
Subject: RE : [PHP-DEV] link to exceptions in autoload thread?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-32607@lists.php.net to get a copy of this message
> > This way, my autoload handler could simply return if the user is > > querying the existence of a class, and die pre-emptively with the > > exception I want in other cases where an E_ERROR would result. > > > This feature would be extremely useful for PEAR2's > implementation of > > autoload. Currently, I check the stack frame of the exception for > > class_exists() prior to die()ing with it, which is risky at > best, and > > a performance hog. > > > Thanks, > > Greg I don't understand why you throw exceptions from an autoload handler. IMO, an autoload handler should just define the class if it can access it, and that's all. I even think that exceptions should be disabled when calling autoload handlers. IMHO, if you die() from your handler, you become incompatible with spl_autoload(), as you cannot know if another handler can resolve the requested symbol. Reagards Francois

« previous php.internals (#32607) next »