Changeset View
Changeset View
Standalone View
Standalone View
src/error/PhutilErrorHandler.php
| Show First 20 Lines • Show All 174 Lines • ▼ Show 20 Lines | /* -( Internals )---------------------------------------------------------- */ | ||||
| * @param int Error code. | * @param int Error code. | ||||
| * @param string Error message. | * @param string Error message. | ||||
| * @param string File where the error occurred. | * @param string File where the error occurred. | ||||
| * @param int Line on which the error occurred. | * @param int Line on which the error occurred. | ||||
| * @param wild Error context information. | * @param wild Error context information. | ||||
| * @return void | * @return void | ||||
| * @task internal | * @task internal | ||||
| */ | */ | ||||
| public static function handleError($num, $str, $file, $line, $ctx) { | public static function handleError($num, $str, $file, $line, $ctx = null) { | ||||
| foreach (self::$traps as $trap) { | foreach (self::$traps as $trap) { | ||||
| $trap->addError($num, $str, $file, $line, $ctx); | $trap->addError($num, $str, $file, $line); | ||||
| } | } | ||||
| if ((error_reporting() & $num) == 0) { | if ((error_reporting() & $num) == 0) { | ||||
| // Respect the use of "@" to silence warnings: if this error was | // Respect the use of "@" to silence warnings: if this error was | ||||
| // emitted from a context where "@" was in effect, the | // emitted from a context where "@" was in effect, the | ||||
| // value returned by error_reporting() will be 0. This is the | // value returned by error_reporting() will be 0. This is the | ||||
| // recommended way to check for this, see set_error_handler() docs | // recommended way to check for this, see set_error_handler() docs | ||||
| // on php.net. | // on php.net. | ||||
| Show All 14 Lines | if (($num === E_USER_ERROR) || | ||||
| $trace = debug_backtrace(); | $trace = debug_backtrace(); | ||||
| array_shift($trace); | array_shift($trace); | ||||
| self::dispatchErrorMessage( | self::dispatchErrorMessage( | ||||
| self::ERROR, | self::ERROR, | ||||
| $str, | $str, | ||||
| array( | array( | ||||
| 'file' => $file, | 'file' => $file, | ||||
| 'line' => $line, | 'line' => $line, | ||||
| 'context' => $ctx, | |||||
| 'error_code' => $num, | 'error_code' => $num, | ||||
| 'trace' => $trace, | 'trace' => $trace, | ||||
| )); | )); | ||||
| return; | return; | ||||
| } | } | ||||
| // Convert typehint failures into exceptions. | // Convert typehint failures into exceptions. | ||||
| ▲ Show 20 Lines • Show All 398 Lines • Show Last 20 Lines | |||||