RE: [PHP-DEV] Re: SPLClassLoader RFC Thoughts And Improvements

From: Date: Fri, 11 Nov 2011 19:37:49 +0000
Subject: RE: [PHP-DEV] Re: SPLClassLoader RFC Thoughts And Improvements
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-56285@lists.php.net to get a copy of this message
On Fri Nov 11 12:13 AM, Stas Malyshev wrote: > > > - MODE_DEBUG: This one can work together with the other two, > > allowing a validation of class/interface/trait presence in the file. > Basically, > > it requires the file and then checks if the item exists in scope. > > Not sure debug adds much here - if the class is not found, you'll be > notified by the engine anyway, so what's the added value? > Right there will be fatal by engine anyway "Class does exist.." Our approach with autoloading has been the following: spl_autoload_register('MV_Autoload'); function MV_Autoload($className) { try { MV_Loader::classImport($className); } catch(MV_ClassNotFound_Exception $e) {} } It seems very wrong to me to generate a fatal error on class_exists() & al. That's unless the spl_autoload_register() api changes and allows to deal with errors - require(), Exception, ...

« previous php.internals (#56285) next »