XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
XoopsErrorHandler Class Reference

Public Member Functions

 __construct ()
 
 activate ($showErrors=false)
 
 handleError ($error)
 
 renderErrors ()
 

Static Public Member Functions

static & getInstance ()
 

Data Fields

 $_errors = []
 
 $_showErrors = false
 
 $_isFatal = false
 

Detailed Description

Definition at line 16 of file errorhandler.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Constructor

Registers the error handler and shutdown functions. NOTE: when registering an error handler, the setting or 'error_reporting' is ignored and everything is trapped.

Definition at line 49 of file errorhandler.php.

Member Function Documentation

◆ activate()

activate ( $showErrors = false)

Activate the error handler

@access public

Parameters
bool$showErrorsTrue if debug mode is on
Returns
void

Definition at line 76 of file errorhandler.php.

◆ getInstance()

static & getInstance ( )
static

Get the (singleton) instance of the error handler

@access public

Definition at line 60 of file errorhandler.php.

◆ handleError()

handleError ( $error)

Handle an error

Parameters
array$errorAssociative array containing error info @access public
Returns
void

Definition at line 88 of file errorhandler.php.

◆ renderErrors()

renderErrors ( )

Render the list of errors

NOTE: Unfortunately PHP 'fatal' and 'parse' errors are not trappable. If the server has 'display_errors Off', then the result will be a blank page. It would be nice to print a message 'This page cannot be displayed', but there seems to be no way to print this only when exiting due to a fatal error rather than normal end of page.

Thus, 'trigger_error' should be used to trap problems early and display a meaningful message before a PHP fatal or parse error can occur.

@TODO Use CSS @TODO Use language? or allow customized message?

@access public

Returns
void

Definition at line 119 of file errorhandler.php.

Field Documentation

◆ $_errors

$_errors = []

Definition at line 24 of file errorhandler.php.

◆ $_isFatal

$_isFatal = false

Definition at line 40 of file errorhandler.php.

◆ $_showErrors

$_showErrors = false

Definition at line 32 of file errorhandler.php.


The documentation for this class was generated from the following file: