示例#1
0
文件: Http.php 项目: hettema/Stages
 /**
  * Fixes CGI only one Status header allowed bug
  *
  * @link  http://bugs.php.net/bug.php?id=36705
  *
  */
 public function sendHeaders()
 {
     if (!$this->canSendHeaders()) {
         App_Main::log('HEADERS ALREADY SENT: ');
         return $this;
     }
     if (substr(php_sapi_name(), 0, 3) == 'cgi') {
         $statusSent = false;
         foreach ($this->_headersRaw as $i => $header) {
             if (stripos($header, 'status:') === 0) {
                 if ($statusSent) {
                     unset($this->_headersRaw[$i]);
                 } else {
                     $statusSent = true;
                 }
             }
         }
         foreach ($this->_headers as $i => $header) {
             if (strcasecmp($header['name'], 'status') === 0) {
                 if ($statusSent) {
                     unset($this->_headers[$i]);
                 } else {
                     $statusSent = true;
                 }
             }
         }
     }
     parent::sendHeaders();
 }
示例#2
0
 /**
  * Not Main exeption handling
  *
  * @param   Exception $exception
  * @param   string $alternativeText
  * @return  Core_Model_Session
  */
 public function addException(Exception $exception, $alternativeText, $showErrorDetail = false)
 {
     // log exception to exceptions log
     $message = sprintf('Exception message: %s%sTrace: %s', $exception->getMessage(), "\n", $exception->getTraceAsString());
     App_Main::log($message, Zend_Log::DEBUG, self::LOG_EXCEPTION_FILE);
     $sessionError = $alternativeText . ($showErrorDetail ? ' :: ' . $exception->getMessage() : '');
     $this->addMessage(App_Main::getSingleton('core/message')->error($sessionError));
     return $this;
 }