예제 #1
0
     }
     fastcgi_finish_request();
 } catch (\Exception $e) {
     $code = $e->getCode();
     session_write_close();
     if ($e instanceof \Lampcms\Lampcms404Exception) {
         $code = '404';
         header("HTTP/1.0 404 Not Found");
     } else {
         $code = '500';
         header("HTTP/1.0 500 Exception");
     }
     try {
         $extra = isset($_SERVER) ? ' $_SERVER: ' . print_r($_SERVER, 1) : ' no server';
         try {
             $extra .= "\n\nREQUEST HEADERS: " . \Lampcms\Request::getAllHeadersAsString() . "\n";
         } catch (\Exception $e) {
             // Unable to use Lampcms\Request class for some reason. Nothing we can do here
         }
         $extra .= "\nException class: " . get_class($e) . "\nMessage:" . $e->getMessage() . "\n in file: " . $e->getFile() . "\n line: " . $e->getLine() . "\n trace: " . $e->getTraceAsString();
         /**
          * @mail must be here before the Lampcms\Exception::formatException
          *       because Lampcms\Exception::formatException in case of ajax request will
          *       send out ajax and then throw \OutOfBoundsException in order to finish request (better than exit())
          */
         if (!$e instanceof \LogicException && $code >= 0 && defined('LAMPCMS_DEVELOPER_EMAIL') && strlen(trim(constant('LAMPCMS_DEVELOPER_EMAIL'))) > 7) {
             $subj = $code . ' Error in index.php';
             if (!is_object($Mailer) || $e instanceof \Lampcms\Mail\SwiftException || $e instanceof \Swift_SwiftException) {
                 @mail(LAMPCMS_DEVELOPER_EMAIL, $subj, $extra);
             } else {
                 try {