Skip to content

Commit

Permalink
FIX: Fixed issue where a crash could occur when an error page is gene…
Browse files Browse the repository at this point in the history
…rated by the CMS (#59)

* FIX: Fixed issue where a crash could occur when an error page is generated by the CMS

* Added doc block
  • Loading branch information
UndefinedOffset authored Feb 1, 2022
1 parent 0349ebb commit 2954224
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/ErrorPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,24 @@
use PageController;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse;
use SilverStripe\View\SSViewer;

/**
* Controller for ErrorPages.
*/
class ErrorPageController extends PageController
{
/**
* Explicitly set themes to the themes config value in case the theme was previously set to something else
* One example of this is when serving 404 error pages under the admin path e.g. admin/non-existent
* where LeftAndMain::init() will have previously set themes to the admin_themes config
*/
protected function init()
{
SSViewer::set_themes(SSViewer::config()->themes);
parent::init();
}

/**
* Overload the provided {@link Controller::handleRequest()} to append the
* correct status code post request since otherwise permission related error
Expand Down

0 comments on commit 2954224

Please sign in to comment.