I am finding that when Zend tries to auto load a file which doesn't exist, it throws an error which I cannot catch in a try/catch block. This happens when I use class_exists
too. I have fixed the problem by hacking zend:
if ($once) {
if (!@include_once ($filename)) {
throw new Exception("Failed to include $filename");
}
// include_once $filename;
}
else {
if (!@include ($filename)) {
throw new Exception("Failed to include $filename");
}
// include $filename;
}
The commented out lines are zend's originals. Now I can catch the exception thrown when a file cannot be included. Can anybody suggest a cleaner way to do this which doesn't involve hacking zend?
I am on Zend version 1.11.10, and the code in question is Zend_Loader line 146.
Thanks.