3

I am upgrading a Silverstripe 3.6.5 site to 4.1.0, just going through the upgrading process. I have struck a hurdle. I am getting this error:

Fatal error: Class 'PageController' not found in /Users/username/Sites/chch-builder-v2-ss4/vendor/silverstripe/errorpage/src/ErrorPageController.php on line 11

This is the ErrorPageController.php file:

<?php
namespace SilverStripe\ErrorPage;

use PageController;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse;

/**
 * Controller for ErrorPages.
 */
class ErrorPageController extends PageController
{
    /**
     * Overload the provided {@link Controller::handleRequest()} to append the
     * correct status code post request since otherwise permission related error
     * pages such as 401 and 403 pages won't be rendered due to
     * {@link HTTPResponse::isFinished() ignoring the response body.
     *
     * @param HTTPRequest $request
     * @return HTTPResponse
     */
    public function handleRequest(HTTPRequest $request)
    {
        /** @var ErrorPage $page */
        $page = $this->data();
        $response = parent::handleRequest($request);
        $response->setStatusCode($page->ErrorCode);
        return $response;
    }
}

What am I missing here/doing wrong?

scrowler
  • 24,273
  • 9
  • 60
  • 92
ifusion
  • 2,163
  • 6
  • 24
  • 44

1 Answers1

2

When upgrading to SilverStripe 4 we need to rename our Page_Controller class to PageController.

3dgoo
  • 15,716
  • 6
  • 46
  • 58