Req #54032 [Opn->Csd]: ability to to handle Class not found error
| From: | tyrael@php.net | Date: | Sun, 04 Dec 2011 23:19:15 +0000 |
| Subject: | Req #54032 [Opn->Csd]: ability to to handle Class not found error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165659@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=54032&edit=1
ID: 54032
Updated by: tyrael@php.net
Reported by: tyra3l at gmail dot com
Summary: ability to to handle Class not found error
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: SPL related
PHP Version: 5.3.5
-Assigned To:
+Assigned To: tyrael
Block user comment: N
Private report: N
New Comment:
if I can come up with something, I will write an RFC instead.
Previous Comments:
------------------------------------------------------------------------
[2011-03-29 09:39:28] tyra3l at gmail dot com
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
------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=54032&edit=1