code = $error[$key]; } $key = 'message'; if (array_key_exists($key, $error)) { $this->message = $error[$key]; } $key = 'file'; if (array_key_exists($key, $error)) { $this->file = $error[$key]; } $key = 'line'; if (array_key_exists($key, $error)) { $this->line = $error[$key]; } } } class Bootstrap { /** * @var Bootstrap */ private static $_instance; /** * @return Bootstrap */ public static function getInstance() { if (!self::$_instance) { self::$_instance = new self(); } return self::$_instance; } /** * */ public function init() { ini_set('display_errors', false); ini_set('html_errors', false); error_reporting(E_ALL | E_STRICT); $captureLevel = null; // any capture level $captureLevel = error_reporting(); // current capture level //$captureLevel = (E_ALL | E_STRICT) ^ E_NOTICE; // ignore notices. I HATE DOING SO! ErrorHandler::register($captureLevel); $bootstrap = $this; register_shutdown_function( function () use ($bootstrap) { var_dump('SHUTDOWN'); $lastError = error_get_last(); $lastErrorType = null; if ( (is_array($lastError)) && (array_key_exists('type', $lastError)) ) { $lastErrorType = $lastError['type']; } if ($lastErrorType === null) { return; } $shutdownException = new \ShutdownException(); $shutdownException->importError($lastError); $bootstrap->handleShutdownException($shutdownException); } ); } /** * @param Exception $exception */ public function handleException(\Exception $exception) { var_dump(__METHOD__); var_dump(get_class($exception) . ' : ' . $exception->getMessage()); } /** * this is the shutdown process! * YOU MUST NOT: * - RETHROW EXCEPTIONS * - RAISE EXCEPTIONS * - PRODUCE ERRORS * @param ShutdownException $exception */ public function handleShutdownException(\ShutdownException $exception) { var_dump(__METHOD__); var_dump( get_class($exception) . ' : ' . $exception->getMessage() . ' code =' . $exception->getCode() . ' file =' . $exception->getFile() . ' line =' . $exception->getLine() . ' catched at: ' . get_class( $this ) . ': ' . __METHOD__ . ':' . __LINE__ ); } } \Bootstrap::getInstance()->init(); try { echo '
';


    include __DIR__ . '/e_notice.php';
    // include __DIR__.'/e_compile_error.php';
    // include __DIR__.'/e_core_error.php';
    //include __DIR__.'/e_parse.php';
    //include __DIR__.'/file_not_exist.php';
    //ini_set('display_errors', true);
    //include __DIR__.'/e_fatal.php';

    var_dump(__FILE__);
} catch (\Exception $e) {

    var_dump('EXCEPTION CATCHED IN ' . __FILE__);

    var_dump($e);
}