Changeset 12143
- Timestamp:
- 10/11/08 16:02:39 (5 years ago)
- Files:
-
- branches/1.2/lib/exception/sfException.class.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.2/lib/exception/sfException.class.php
r12138 r12143 96 96 static protected function outputStackTrace(Exception $exception) 97 97 { 98 $format = 'html'; 99 $code = '500'; 100 $text = 'Internal Server Error'; 101 98 102 if (class_exists('sfContext', false) && sfContext::hasInstance()) 99 103 { … … 114 118 $response = sfContext::getInstance()->getResponse(); 115 119 116 if ( $response->getStatusCode() < 300)120 if (is_object($response) && $response->getStatusCode() < 300) 117 121 { 118 122 // status code has already been sent, but is included here for the purpose of testing … … 120 124 } 121 125 122 if ($mimeType = $request->getMimeType($format = $request->getRequestFormat())) 123 { 124 $response->setContentType($mimeType); 125 } 126 else 127 { 128 $format = 'html'; 126 if (is_object($response)) 127 { 129 128 $response->setContentType('text/html'); 130 } 131 129 130 if (!sfConfig::get('sf_test')) 131 { 132 foreach ($response->getHttpHeaders() as $name => $value) 133 { 134 header($name.': '.$value); 135 } 136 } 137 138 $code = $response->getStatusCode(); 139 $text = $response->getStatusText(); 140 141 if ($mimeType = $request->getMimeType($format = $request->getRequestFormat())) 142 { 143 $response->setContentType($mimeType); 144 } 145 } 146 } 147 else 148 { 149 // a backward compatible default 132 150 if (!sfConfig::get('sf_test')) 133 151 { 134 foreach ($response->getHttpHeaders() as $name => $value)135 {136 header($name.': '.$value);137 }138 }139 140 $code = $response->getStatusCode();141 $text = $response->getStatusText();142 }143 else144 {145 // a backward compatible default146 $format = 'html';147 148 if (!sfConfig::get('sf_test'))149 {150 152 header('Content-Type: text/html; charset='.sfConfig::get('sf_charset', 'utf-8')); 151 153 } 152 153 $code = '500';154 $text = 'Internal Server Error';155 154 } 156 155