O'Reilly logo

PHP 5 CMS Framework Development by Martin Brampton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Framework solution

The first thing we need is the error handler class, which is invoked almost at the start of processing any request with the code:

$errorhandler = aliroErrorRecorder::getInstance($controller);
set_error_handler(array($errorhandler, 'PHPerror'));

What this does is create an error handler object from aliroErrorRecorder and to tell PHP to use the object's PHPerror method when an error is detected. The first part of the error handling class is as follows:

final class aliroErrorRecorder extends aliroDatabaseRow { protected static $instance = null; protected $DBclass = 'aliroCoreDatabase'; protected $tableName = '#__error_log'; protected $rowKey = 'id'; public static function getInstance ($request=null) { return (null == self::$instance) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required