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) ? (self::$instance = new self()) : self::$instance; } public function PHPerror ($errno, $errstr, $errfile, $errline, $errcontext) { if (!($errno & error_reporting())) return; $rawmessage = function_exists('T_') ? T_('PHP Error %s: %s in ...