From 358b2582bc6827c38b67b77c73e65b025e07531a Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 20 May 2014 13:40:52 +0000 Subject: [PATCH] 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. --- application/controllers/ErrorController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/controllers/ErrorController.php b/application/controllers/ErrorController.php index 343a40b7f..74e2e8b52 100644 --- a/application/controllers/ErrorController.php +++ b/application/controllers/ErrorController.php @@ -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();