| @@ 217-238 (lines=22) @@ | ||
| 214 | set_exception_handler('exceptionHandler'); |
|
| 215 | } |
|
| 216 | ||
| 217 | public static function noticeHandler($errno, $errstr, $errfile, $errline, $errcontext) { |
|
| 218 | if(error_reporting() == 0) return; |
|
| 219 | ini_set('display_errors', 0); |
|
| 220 | ||
| 221 | // Send out the error details to the logger for writing |
|
| 222 | SS_Log::log( |
|
| 223 | array( |
|
| 224 | 'errno' => $errno, |
|
| 225 | 'errstr' => $errstr, |
|
| 226 | 'errfile' => $errfile, |
|
| 227 | 'errline' => $errline, |
|
| 228 | 'errcontext' => $errcontext |
|
| 229 | ), |
|
| 230 | SS_Log::NOTICE |
|
| 231 | ); |
|
| 232 | ||
| 233 | if(Director::isDev()) { |
|
| 234 | return self::showError($errno, $errstr, $errfile, $errline, $errcontext, "Notice"); |
|
| 235 | } else { |
|
| 236 | return false; |
|
| 237 | } |
|
| 238 | } |
|
| 239 | ||
| 240 | /** |
|
| 241 | * Handle a non-fatal warning error thrown by PHP interpreter. |
|
| @@ 249-270 (lines=22) @@ | ||
| 246 | * @param unknown_type $errline |
|
| 247 | * @param unknown_type $errcontext |
|
| 248 | */ |
|
| 249 | public static function warningHandler($errno, $errstr, $errfile, $errline, $errcontext) { |
|
| 250 | if(error_reporting() == 0) return; |
|
| 251 | ini_set('display_errors', 0); |
|
| 252 | ||
| 253 | // Send out the error details to the logger for writing |
|
| 254 | SS_Log::log( |
|
| 255 | array( |
|
| 256 | 'errno' => $errno, |
|
| 257 | 'errstr' => $errstr, |
|
| 258 | 'errfile' => $errfile, |
|
| 259 | 'errline' => $errline, |
|
| 260 | 'errcontext' => $errcontext |
|
| 261 | ), |
|
| 262 | SS_Log::WARN |
|
| 263 | ); |
|
| 264 | ||
| 265 | if(Director::isDev()) { |
|
| 266 | return self::showError($errno, $errstr, $errfile, $errline, $errcontext, "Warning"); |
|
| 267 | } else { |
|
| 268 | return false; |
|
| 269 | } |
|
| 270 | } |
|
| 271 | ||
| 272 | /** |
|
| 273 | * Handle a fatal error, depending on the mode of the site (ie: Dev, Test, or Live). |
|