#26591 [Opn->Csd]: "__autoload threw an exception" during an uncaught Exception
| From: | helly@php.net | Date: | Thu, 11 Dec 2003 18:15:48 +0000 |
| Subject: | #26591 [Opn->Csd]: "__autoload threw an exception" during an uncaught Exception | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-51956@lists.php.net to get a copy of this message | ||
ID: 26591
Updated by: helly@php.net
Reported By: bugzilla at malkusch dot de
-Status: Open
+Status: Closed
Bug Type: Class/Object related
Operating System: Debian Woody
PHP Version: 5.0.0b2 (beta2)
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2003-12-11 07:30:30] bugzilla at malkusch dot de
Description:
------------
If I use __autoload() PHP says "__autoload threw an exception" while I
throw an exception which would be caught somewhere between several
catch statements.
That means __autoload() first loads the Class for the thrown Exception
then PHP searches a catch statement for the threwn exception. The
first statement is for another Exception (the exception still is
uncaught) so __autoload should load this class. But here it fails and
says "__autoload threw an exception".
A Workaround would be to require all Exceptions for all catch
Statements before any exception is thrown.
Reproduce code:
---------------
// Be sure that Test1.php and Test2.php exists
function __autoload($className) {
echo '<br>' . $className;
require_once ucfirst($className) . '.php';
echo 'loaded';
}
// If I would do "require_once Test1.php;" here
// everything would work
try {
throw new Test2();
} catch(Test1 $e) {
} catch(Test2 $e) {
}
Expected result:
----------------
test2loaded
test1loaded
Actual result:
--------------
test2loaded
test1
Fatal error: __autoload threw an exception in
/home/malkusch/http/index.php on line 13
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26591&edit=1