PHP Class PMA\libraries\ErrorHandler

Afficher le fichier Open project: phpmyadmin/phpmyadmin

Protected Properties

Свойство Type Description
$errors Error[] ..
$hide_location Hide location of errors

Méthodes publiques

Méthode Description
__construct ( ) Constructor - set PHP error handler
__destruct ( ) Destructor
addError ( string $errstr, integer $errno, string $errfile, integer $errline, boolean $escape = true ) : void Add an error; can also be called directly (with or without escaping)
countDisplayErrors ( ) : integer number of errors to be displayed
countErrors ( boolean $check = true ) : integer return count of errors
countUserErrors ( ) : integer return count of user errors
dispErrors ( ) : void displays errors not displayed
dispUserErrors ( ) : void Displays user errors not displayed
getCurrentErrors ( ) : Error[] returns the errors occurred in the current run only.
getDispErrors ( ) : string renders errors not displayed
getDispUserErrors ( ) : string Renders user errors not displayed
getErrors ( boolean $check = true ) : Error[] returns array with all errors
handleError ( integer $errno, string $errstr, string $errfile, integer $errline ) : void Error handler - called when errors are triggered/occurred
hasDisplayErrors ( ) : boolean whether there are errors to display or not
hasErrors ( ) : boolean whether errors occurred or not
hasErrorsForPrompt ( ) : boolean Function to check if there are any errors to be prompted.
hasUserErrors ( ) : boolean whether use errors occurred or not
reportErrors ( ) : void Function to report all the collected php errors.
savePreviousErrors ( ) : void Deletes previously stored errors in SESSION.
setHideLocation ( boolean $hide ) : void Toggles location hiding
sliceErrors ( integer $count ) : Error[] Pops recent errors from the storage
triggerError ( string $errorInfo, integer $errorNumber = null ) : void trigger a custom error

Méthodes protégées

Méthode Description
checkSavedErrors ( ) : void look in session for saved errors
dispFatalError ( Error $error ) : void display fatal error and exit
dispPageEnd ( ) : void display HTML footer
dispPageStart ( Error $error = null ) : void display HTML header

Method Details

__construct() public méthode

Constructor - set PHP error handler
public __construct ( )

__destruct() public méthode

stores errors in session
public __destruct ( )

addError() public méthode

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']
public addError ( string $errstr, integer $errno, string $errfile, integer $errline, boolean $escape = true ) : void
$errstr string error string
$errno integer error number
$errfile string error file
$errline integer error line
$escape boolean whether to escape the error string
Résultat void

checkSavedErrors() protected méthode

look in session for saved errors
protected checkSavedErrors ( ) : void
Résultat void

countDisplayErrors() public méthode

number of errors to be displayed
public countDisplayErrors ( ) : integer
Résultat integer number of errors to be displayed

countErrors() public méthode

return count of errors
public countErrors ( boolean $check = true ) : integer
$check boolean Whether to check for session errors
Résultat integer number of errors occurred

countUserErrors() public méthode

return count of user errors
public countUserErrors ( ) : integer
Résultat integer number of user errors occurred

dispErrors() public méthode

displays errors not displayed
public dispErrors ( ) : void
Résultat void

dispFatalError() protected méthode

display fatal error and exit
protected dispFatalError ( Error $error ) : void
$error Error the error
Résultat void

dispPageEnd() protected méthode

display HTML footer
protected dispPageEnd ( ) : void
Résultat void

dispPageStart() protected méthode

display HTML header
protected dispPageStart ( Error $error = null ) : void
$error Error the error
Résultat void

dispUserErrors() public méthode

Displays user errors not displayed
public dispUserErrors ( ) : void
Résultat void

getCurrentErrors() public méthode

Does not include the errors saved in the SESSION
public getCurrentErrors ( ) : Error[]
Résultat Error[]

getDispErrors() public méthode

renders errors not displayed
public getDispErrors ( ) : string
Résultat string

getDispUserErrors() public méthode

Renders user errors not displayed
public getDispUserErrors ( ) : string
Résultat string

getErrors() public méthode

returns array with all errors
public getErrors ( boolean $check = true ) : Error[]
$check boolean Whether to check for session errors
Résultat Error[]

handleError() public méthode

This calls the addError() function, escaping the error string Ignores the errors wherever Error Control Operator (@) is used.
public handleError ( integer $errno, string $errstr, string $errfile, integer $errline ) : void
$errno integer error number
$errstr string error string
$errfile string error file
$errline integer error line
Résultat void

hasDisplayErrors() public méthode

whether there are errors to display or not
public hasDisplayErrors ( ) : boolean
Résultat boolean

hasErrors() public méthode

whether errors occurred or not
public hasErrors ( ) : boolean
Résultat boolean

hasErrorsForPrompt() public méthode

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.
public hasErrorsForPrompt ( ) : boolean
Résultat boolean true if there are errors to be "prompted", false otherwise

hasUserErrors() public méthode

whether use errors occurred or not
public hasUserErrors ( ) : boolean
Résultat boolean

reportErrors() public méthode

Must be called at the end of each script by the $GLOBALS['error_handler'] only.
public reportErrors ( ) : void
Résultat void

savePreviousErrors() public méthode

Saves current errors in session as previous errors. Required to save current errors in case 'ask'
public savePreviousErrors ( ) : void
Résultat void

setHideLocation() public méthode

Toggles location hiding
public setHideLocation ( boolean $hide ) : void
$hide boolean Whether to hide
Résultat void

sliceErrors() public méthode

Pops recent errors from the storage
public sliceErrors ( integer $count ) : Error[]
$count integer Old error count
Résultat Error[]

triggerError() public méthode

trigger a custom error
public triggerError ( string $errorInfo, integer $errorNumber = null ) : void
$errorInfo string error message
$errorNumber integer error number
Résultat void

Property Details

$errors protected_oe property

..
protected Error[],PMA\libraries $errors
Résultat Error[]

$hide_location protected_oe property

Hide location of errors
protected $hide_location