PHP5: __autoload() and Exceptions

From: Date: Mon, 08 Mar 2004 12:10:16 +0000
Subject: PHP5: __autoload() and Exceptions
Groups: php.general 
Request: Send a blank email to php-general+get-179735@lists.php.net to get a copy of this message
Hi All, I did some tests with the exception's under PHP5. I wanted to use the __autoload()-function to use for class loading. The function should throw an exception if it was not possible to load the class. Code should be like that: ----------------------------------------- try { $x = new classname; } catch (Exception $exception) { die('class not found'); } ----------------------------------------- But I get an error, that the thrown exception is not cought... Samplecode of __autoload(): ----------------------------------------- function __autoload($name) { throw new Exception(); } ----------------------------------------- Is this an error of the PHP5-CVS-Version or is it impossible to catch exceptions thrown by the __autoload()-function? David Danier

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.general (#179735) next »