From ff6c0a3160c5eb3ca624efea6585efb44399dc1c Mon Sep 17 00:00:00 2001 From: Patrick Nelson Date: Thu, 8 Oct 2015 17:48:00 -0400 Subject: [PATCH] FIX (v3.1) for #1294 to workaround ErrorPage fatal errors (and undefined var) when publishing. --- code/model/ErrorPage.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/model/ErrorPage.php b/code/model/ErrorPage.php index c0118997..25482e4c 100644 --- a/code/model/ErrorPage.php +++ b/code/model/ErrorPage.php @@ -222,10 +222,10 @@ class ErrorPage extends Page { * content, so the page can be shown even when SilverStripe is not * functioning correctly before publishing this page normally. * - * @return void + * @return bool */ public function doPublish() { - parent::doPublish(); + if (!parent::doPublish()) return false; // Run the page (reset the theme, it might've been disabled by LeftAndMain::init()) $oldEnabled = Config::inst()->get('SSViewer', 'theme_enabled'); @@ -255,11 +255,13 @@ class ErrorPage extends Page { $fileErrorText = _t( "ErrorPage.ERRORFILEPROBLEM", "Error opening file \"{filename}\" for writing. Please check file permissions.", - array('filename' => $errorFile) + array('filename' => $filePath) ); - $this->response->addHeader('X-Status', rawurlencode($fileErrorText)); - return $this->httpError(405); + user_error($fileErrorText, E_USER_WARNING); + return false; } + + return true; } /**