Edit report at http://bugs.php.net/bug.php?id=54032&edit=1

 ID:                 54032
 Comment by:         tyra3l at gmail dot com
 Reported by:        tyra3l at gmail dot com
 Summary:            ability to to handle Class not found error
 Status:             Open
 Type:               Feature/Change Request
 Package:            SPL related
 PHP Version:        5.3.5
 Block user comment: N
 Private report:     N

 New Comment:

after some sleep and a little bit thinking, I think that the best
solution would 

be to introduce a new Exception type, which will be thrown if the
execution of the 

autoload callbacks doesn't successfully load the class.

what do you think?



Tyrael


Previous Comments:
------------------------------------------------------------------------
[2011-02-17 00:15:36] tyra3l at gmail dot com

*exists -> exit

*exection -> execution

* spl autoload callbacks was executed -> spl autoload callbacks was
executed 

without finding the class

* I cannot continue the normal execution flow -> I couldn't continue the
normal 

execution flow

* from a higher level -> at a higher level



sorry, its getting late, and my english skill degrades with sleep
deprivation

------------------------------------------------------------------------
[2011-02-17 00:11:01] tyra3l at gmail dot com

Description:
------------
currently you can throw an exception from the autoloader, hence if you
can't 

find a class, your application can gracefully exists, instead of exiting
via the 

class not found fatal error.

my problem is, that I would like to use multiple autoloader (for example
in a 

project which uses multiple component, or framework), but in this case,
I can't 

throw an Exception from my autoloader, because maybe the other
autoloaders could 

load the class.

if I'm sure that I will register the last autoloader, the this isn't a 

problem(my last autoloader will throw the Exception on missing class),
but maybe 

I have to load a component late of the exection.

it would be cool, if I could somehow register a callback which will be
called, 

when the spl autoload callbacks was executed, but the class couldn't be
loaded

of course, from this callback, I cannot continue the normal execution
flow, 

however I can log the error, and let the callback return and get the
class not 

found fatal error, or throw an Exception, and handle/log the error from
a higher 

level.



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=54032&edit=1

Reply via email to