From 0d2968f8e0b1e3258629827e5bad397979edc860 Mon Sep 17 00:00:00 2001 From: Richard Quadling Date: Wed, 25 Nov 2009 11:00:11 +0000 Subject: [PATCH] Autoload and exceptions work. Mostly. Fix#50250 git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@291300 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/oop5/autoload.xml | 70 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/language/oop5/autoload.xml b/language/oop5/autoload.xml index 21aef05751..bf4c04738f 100644 --- a/language/oop5/autoload.xml +++ b/language/oop5/autoload.xml @@ -17,9 +17,13 @@ - Exceptions thrown in __autoload function cannot be caught in the - catch block and results in - a fatal error. + Prior to 5.3.0, exceptions thrown in the __autoload function could not be + caught in the catch block and + would result in a fatal error. From 5.3.0+ exceptions thrown in the + __autoload function can be caught in the + catch block, with 1 proviso. If throwing a custom exception, then + the custom exception class must be available. The __autoload function may + be used recursively to autoload the custom exception class. @@ -82,6 +86,66 @@ Fatal error: Interface 'ITest' not found in ... ]]> + + Autoloading with exception handling for 5.3.0+ + + This example throws an exception and demonstrates the try/catch block. + + +getMessage(), "\n"; +} +?> +]]> + + &example.outputs; + + + + + + Autoloading with exception handling for 5.3.0+ - Missing custom exception + + This example throws an exception for a non-loadable, custom exception. + + +getMessage(), "\n"; +} +?> +]]> + + &example.outputs; + + + +