Skip to content

Commit

Permalink
FIX (v3.1) for #1294 to workaround ErrorPage fatal errors (and undefi…
Browse files Browse the repository at this point in the history
…ned var) when publishing.
  • Loading branch information
patricknelson committed Oct 8, 2015
1 parent 0df0f35 commit ff6c0a3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions code/model/ErrorPage.php
Expand Up @@ -222,10 +222,10 @@ public function getCMSFields() {
* content, so the page can be shown even when SilverStripe is not * content, so the page can be shown even when SilverStripe is not
* functioning correctly before publishing this page normally. * functioning correctly before publishing this page normally.
* *
* @return void * @return bool
*/ */
public function doPublish() { public function doPublish() {
parent::doPublish(); if (!parent::doPublish()) return false;


// Run the page (reset the theme, it might've been disabled by LeftAndMain::init()) // Run the page (reset the theme, it might've been disabled by LeftAndMain::init())
$oldEnabled = Config::inst()->get('SSViewer', 'theme_enabled'); $oldEnabled = Config::inst()->get('SSViewer', 'theme_enabled');
Expand Down Expand Up @@ -255,11 +255,13 @@ public function doPublish() {
$fileErrorText = _t( $fileErrorText = _t(
"ErrorPage.ERRORFILEPROBLEM", "ErrorPage.ERRORFILEPROBLEM",
"Error opening file \"{filename}\" for writing. Please check file permissions.", "Error opening file \"{filename}\" for writing. Please check file permissions.",
array('filename' => $errorFile) array('filename' => $filePath)
); );
$this->response->addHeader('X-Status', rawurlencode($fileErrorText)); user_error($fileErrorText, E_USER_WARNING);
return $this->httpError(405); return false;
} }

return true;
} }


/** /**
Expand Down

0 comments on commit ff6c0a3

Please sign in to comment.