LAUPRETRE François (P) wrote: >>> 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.
Exceptions thrown cause an E_ERROR. I'm not throwing an exception > 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. Your opinion is wrong. PEAR2's autoload returns false for any classes not prefixed by "PEAR2" Greg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php