ErrorController: show valid title for exceptions

Multiline strings are not considered being a valid title. This patch
strips all but the first line from the exception message when setting
the title attribute.
This commit is contained in:
Thomas Gelf 2014-05-20 13:40:52 +00:00
parent 33e326a232
commit 358b2582bc
1 changed files with 2 additions and 1 deletions

View File

@ -66,8 +66,9 @@ class ErrorController extends ActionController
break;
default:
$title = preg_replace('/\r?\n.*$/s', '', $exception->getMessage());
$this->getResponse()->setHttpResponseCode(500);
$this->view->title = 'Server error: ' . $exception->getMessage();
$this->view->title = 'Server error: ' . $title;
$this->view->message = $exception->getMessage();
if ($this->getInvokeArg('displayExceptions') == true) {
$this->view->stackTrace = $exception->getTraceAsString();