Slide 42
Slide 42 text
set_error_handler(
function($errno, $msg, $file, $line) {
switch ($errno) {
case E_RECOVERABLE_ERROR:
case E_USER_ERROR:
throw new \ErrorException($msg, null, $errno, $file, $line);
case E_WARNING:
case E_USER_WARNING:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
throw new WarningException($msg, null, $errno, $file, $line);
case E_NOTICE:
case E_USER_NOTICE:
throw new NoticeException($msg, null, $errno, $file, $line);
case E_STRICT:
throw new StrictException($msg, null, $errno, $file, $line);
}
return true;
});
$a = [];
try {
$b = $a['doesNotExist'];
} catch (NoticeException $e) {
}