コード例 #1
0
 /**
  * Handles fatal PHP errors
  */
 public function handleFatalError()
 {
     unset($this->_memoryReserve);
     // load ErrorException manually here because autoloading them will not work
     // when error occurs while autoloading a class
     if (!class_exists('Leaps\\Base\\ErrorException', false)) {
         require_once __DIR__ . '/ErrorException.php';
     }
     $error = error_get_last();
     if (ErrorException::isFatalError($error)) {
         if (!empty($this->_hhvmException)) {
             $exception = $this->_hhvmException;
         } else {
             $exception = new ErrorException($error['message'], $error['type'], $error['type'], $error['file'], $error['line']);
         }
         $this->exception = $exception;
         $this->logException($exception);
         if ($this->discardExistingOutput) {
             $this->clearOutput();
         }
         $this->renderException($exception);
         // need to explicitly flush logs because exit() next will terminate the app immediately
         Leaps::getLogger()->flush(true);
         if (defined('HHVM_VERSION')) {
             flush();
         }
         exit(1);
     }
 }