‪TYPO3CMS  9.5
TYPO3\CMS\Frontend\Controller\ErrorController Class Reference

Public Member Functions

ResponseInterface unavailableAction (ServerRequestInterface $request, string $message, array $reasons=[])
 
ResponseInterface pageNotFoundAction (ServerRequestInterface $request, string $message, array $reasons=[])
 
ResponseInterface accessDeniedAction (ServerRequestInterface $request, string $message, array $reasons=[])
 

Protected Member Functions

bool isPageUnavailableHandlerConfigured ()
 
ResponseInterface handlePageError ($errorHandler, string $header='', string $reason='', array $pageAccessFailureReasons=[])
 
ResponseInterface applySanitizedHeadersToResponse (ResponseInterface $response, string $headers)
 
PageErrorHandlerInterface null getErrorHandlerFromSite (ServerRequestInterface $request, int $statusCode)
 

Detailed Description

Handles "Page Not Found" or "Page Unavailable" requests, returns a response object.

Definition at line 34 of file ErrorController.php.

Member Function Documentation

◆ accessDeniedAction()

ResponseInterface TYPO3\CMS\Frontend\Controller\ErrorController::accessDeniedAction ( ServerRequestInterface  $request,
string  $message,
array  $reasons = [] 
)

Used for creating a 403 response ("Access denied"), but if configured, a RedirectResponse could be returned as well.

Parameters
ServerRequestInterface$request
string$message
array$reasons
Returns
‪ResponseInterface

Definition at line 99 of file ErrorController.php.

References $GLOBALS, TYPO3\CMS\Frontend\Controller\ErrorController\getErrorHandlerFromSite(), and TYPO3\CMS\Frontend\Controller\ErrorController\handlePageError().

◆ applySanitizedHeadersToResponse()

ResponseInterface TYPO3\CMS\Frontend\Controller\ErrorController::applySanitizedHeadersToResponse ( ResponseInterface  $response,
string  $headers 
)
protected

Headers which have been requested, will be added to the response object. If a header is part of the HTTP Response code, the response object will be annotated as well.

Parameters
ResponseInterface$response
string$headers
Returns
‪ResponseInterface

Definition at line 278 of file ErrorController.php.

Referenced by TYPO3\CMS\Frontend\Controller\ErrorController\handlePageError().

◆ getErrorHandlerFromSite()

PageErrorHandlerInterface null TYPO3\CMS\Frontend\Controller\ErrorController::getErrorHandlerFromSite ( ServerRequestInterface  $request,
int  $statusCode 
)
protected

Checks if a site is configured, and an error handler is configured for this specific status code.

Parameters
ServerRequestInterface$request
int$statusCode
Returns
‪PageErrorHandlerInterface|null

Definition at line 305 of file ErrorController.php.

Referenced by TYPO3\CMS\Frontend\Controller\ErrorController\accessDeniedAction(), TYPO3\CMS\Frontend\Controller\ErrorController\pageNotFoundAction(), and TYPO3\CMS\Frontend\Controller\ErrorController\unavailableAction().

◆ handlePageError()

ResponseInterface TYPO3\CMS\Frontend\Controller\ErrorController::handlePageError (   $errorHandler,
string  $header = '',
string  $reason = '',
array  $pageAccessFailureReasons = [] 
)
protected

Generic error page handler.

Parameters
mixed$errorHandler‪See docs of ['FE']['pageNotFound_handling'] and ['FE']['pageUnavailable_handling'] for all possible values
string$header‪If set, this is passed directly to the PHP function, header()
string$reason‪If set, error messages will also mention this as the reason for the page-not-found.
array$pageAccessFailureReasons
Returns
‪ResponseInterface
Exceptions

Definition at line 140 of file ErrorController.php.

References TYPO3\CMS\Frontend\Controller\ErrorController\applySanitizedHeadersToResponse().

Referenced by TYPO3\CMS\Frontend\Controller\ErrorController\accessDeniedAction(), TYPO3\CMS\Frontend\Controller\ErrorController\pageNotFoundAction(), and TYPO3\CMS\Frontend\Controller\ErrorController\unavailableAction().

◆ isPageUnavailableHandlerConfigured()

bool TYPO3\CMS\Frontend\Controller\ErrorController::isPageUnavailableHandlerConfigured ( )
protected

Checks whether the pageUnavailableHandler should be used. To be used, pageUnavailable_handling must be set and devIPMask must not match the current visitor's IP address.

Returns
‪bool TRUE/FALSE whether the pageUnavailable_handler should be used.

Definition at line 119 of file ErrorController.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Frontend\Controller\ErrorController\unavailableAction().

◆ pageNotFoundAction()

ResponseInterface TYPO3\CMS\Frontend\Controller\ErrorController::pageNotFoundAction ( ServerRequestInterface  $request,
string  $message,
array  $reasons = [] 
)

Used for creating a 404 response ("Page Not Found"), but if configured, a RedirectResponse could be returned as well.

Parameters
ServerRequestInterface$request
string$message
array$reasons
Returns
‪ResponseInterface
Exceptions
PageNotFoundException

Definition at line 73 of file ErrorController.php.

References $GLOBALS, TYPO3\CMS\Frontend\Controller\ErrorController\getErrorHandlerFromSite(), and TYPO3\CMS\Frontend\Controller\ErrorController\handlePageError().

◆ unavailableAction()

ResponseInterface TYPO3\CMS\Frontend\Controller\ErrorController::unavailableAction ( ServerRequestInterface  $request,
string  $message,
array  $reasons = [] 
)

Used for creating a 500 response ("Page unavailable"), usually due some misconfiguration but if configured, a RedirectResponse could be returned as well.

Parameters
ServerRequestInterface$request
string$message
array$reasons
Returns
‪ResponseInterface
Exceptions
ServiceUnavailableException

Definition at line 46 of file ErrorController.php.

References $GLOBALS, TYPO3\CMS\Frontend\Controller\ErrorController\getErrorHandlerFromSite(), TYPO3\CMS\Frontend\Controller\ErrorController\handlePageError(), and TYPO3\CMS\Frontend\Controller\ErrorController\isPageUnavailableHandlerConfigured().