Author: dr Date: Fri Feb 22 13:04:36 2008 New Revision: 7431 Log: - Add note on catching the autoload exceptions in the autoload mechanism.
Modified: trunk/Base/docs/tutorial.txt trunk/Base/src/options/autoload.php Modified: trunk/Base/docs/tutorial.txt ============================================================================== --- trunk/Base/docs/tutorial.txt [iso-8859-1] (original) +++ trunk/Base/docs/tutorial.txt [iso-8859-1] Fri Feb 22 13:04:36 2008 @@ -23,7 +23,7 @@ for instructions on installation and configuration of the eZ Components library and the Base component. -.. _Components Introduction: http://ez.no/community/articles/an_introduction_to_ez_components +.. _Components Introduction: /docs/install Usage @@ -43,6 +43,23 @@ $options->debug = true; ezcBase::setOptions( $options ); ?> + +**Warning**: Exceptions are ignored when they are thrown from an autoload() +handler in PHP. In order to see the exception message that is thrown when a +class can not be found, you need to catch the exception *in* the autoload() +handler. Your autoload() function could then look like:: + + function __autoload( $className ) + { + try + { + ezcBase::autoload( $className ); + } + catch ( Exception $e ) + { + echo $e->getMessage(); + } + } Preloading ---------- Modified: trunk/Base/src/options/autoload.php ============================================================================== --- trunk/Base/src/options/autoload.php [iso-8859-1] (original) +++ trunk/Base/src/options/autoload.php [iso-8859-1] Fri Feb 22 13:04:36 2008 @@ -17,7 +17,9 @@ * component are loaded as well (except for Exception classes). * @property bool $debug * If debug is enabled then the autoload method will show exceptions - * when a class can not be found. + * when a class can not be found. Because exceptions are ignored by + * PHP in the autoload handler, you have to catch them in autoload() + * yourself and do something with the exception message. * * @package Base * @version //autogen// -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components