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; + + + +