ErrorHandler
class ErrorHandler (View source)
handling errors
Properties
protected Error[] | $errors | holds errors to be displayed or reported later . |
|
protected bool | $hideLocation | Hide location of errors |
|
protected int | $errorReporting | Initial error reporting state |
Methods
No description
No description
Destructor
Toggles location hiding
returns array with all errors
returns the errors occurred in the current run only.
Pops recent errors from the storage
Error handler - called when errors are triggered/occurred
Add an error; can also be called directly (with or without escaping)
Displays user errors not displayed
renders errors not displayed
return count of errors
No description
whether there are errors to display or not
Deletes previously stored errors in SESSION.
Function to check if there are any errors to be prompted.
Function to report all the collected php errors.
Details
__construct()
No description
static ErrorHandler
getInstance()
No description
__destruct()
Destructor
stores errors in session
void
setHideLocation(bool $hide)
Toggles location hiding
array
getErrors(bool $check = true)
returns array with all errors
array
getCurrentErrors()
returns the errors occurred in the current run only.
Does not include the errors saved in the SESSION
array
sliceErrors(int $count)
Pops recent errors from the storage
bool
handleError(int $errno, string $errstr, string $errfile, int $errline)
Error handler - called when errors are triggered/occurred
This calls the addError() function, escaping the error string Ignores the errors wherever Error Control Operator (@) is used.
void
handleException(Throwable $exception)
Hides exception if it's not in the development environment.
void
addError(string $errstr, int $errno, string $errfile, int $errline, bool $escape = true)
Add an error; can also be called directly (with or without escaping)
The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the file where set_error_handler() is called.
Do not use the context parameter as we want to avoid storing the complete $GLOBALS inside $_SESSION['errors']
protected never
dispFatalError(Error $error)
display fatal error and exit
void
dispUserErrors()
Displays user errors not displayed
string
getDispErrors()
renders errors not displayed
int
countErrors(bool $check = true)
return count of errors
int
countUserErrors()
No description
bool
hasDisplayErrors()
whether there are errors to display or not
void
savePreviousErrors()
Deletes previously stored errors in SESSION.
Saves current errors in session as previous errors. Required to save current errors in case 'ask'
bool
hasErrorsForPrompt()
Function to check if there are any errors to be prompted.
Needed because user warnings raised are also collected by global error handler. This distinguishes between the actual errors and user errors raised to warn user.
void
reportErrors()
Function to report all the collected php errors.
Must be called at the end of each script by the {\PhpMyAdmin\Error\getInstance()} only.