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

From: Date: Wed, 03 Oct 2007 19:50:38 +0000
Subject: Re: RE : [PHP-DEV] link to exceptions in autoload thread?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-32610@lists.php.net to get a copy of this message
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

« previous php.internals (#32610) next »