DebugExceptionHandler extends AbstractExceptionHandler
A basic but solid exception handler which catches everything which falls through the other exception handlers and provides useful debugging information.
Table of Contents
Constants
- CONTEXT_CLI = 'CLI'
- CONTEXT_WEB = 'WEB'
- IGNORED_HMAC_EXCEPTION_CODES = [ 1581862822, // Failed HMAC validation due to modified __trustedProperties in extbase property mapping 1581862823, // Failed HMAC validation due to modified form state in ext:forms 1320830018, // Failed HMAC validation due to modified HMAC string in Extbase HashService 1320830276, // Failed HMAC validation due to too short HMAC string in Extbase HashService 1704454157, // Failed HMAC validation due to modified HMAC string in Core HashService 1704454152, ]
- IGNORED_EXCEPTION_CODES = [ 1396795884, // Current host header value does not match the configured trusted hosts pattern 1616175867, // Backend login request is rate limited 1616175847, // Frontend login request is rate limited 1436717275, // Request with unsupported HTTP method 1699604555, // Outdated __trustedProperties format in extbase property mapping 1517949792, // The IP address of your client does not match the list of allowed IP addresses 1517949793, // Backend access by browser is locked for maintenance 1517949794, // Backend and Install Tool are locked for maintenance 1436717270, // Client sends a header with an invalid name 1436717269, ]
Properties
- $logExceptionStackTrace : bool
Methods
- __construct() : mixed
- Constructs this exception handler - registers itself as the default exception handler.
- echoExceptionCLI() : mixed
- Formats and echoes the exception for the command line
- echoExceptionWeb() : mixed
- Formats and echoes the exception as XHTML.
- handleException() : mixed
- Displays the given exception
- anonymizeToken() : string
- Replaces the generated token with a generic equivalent
- escapeHtml() : string
- flattenArgs() : array<string|int, mixed>
- formatArgs() : string
- Formats the arguments of a method call.
- formatPath() : string
- Formats a path adding a line number.
- getAllThrowables() : array<string|int, mixed>
- getBackendUser() : BackendUserAuthentication|null
- getBacktraceCode() : string
- Renders the backtrace as HTML.
- getClassNameFromIncomplete() : string
- getCodeSnippet() : string
- Returns a code snippet from the specified file.
- getContent() : string
- Generates the HTML for the error output.
- getSingleThrowableContent() : string
- Renders the HTML for a single throwable.
- getStylesheet() : string
- Generates the stylesheet needed to display the error page.
- getTypo3LogoAsSvg() : string
- sendStatusHeaders() : mixed
- Sends the HTTP Status 500 code, if $exception is *not* a TYPO3\CMS\Core\Error\Http\StatusException and headers are not sent, yet.
- writeLog() : mixed
- Writes an exception in the sys_log table
- writeLogEntries() : void
- Writes exception to different logs
Constants
CONTEXT_CLI
public
mixed
CONTEXT_CLI
= 'CLI'
CONTEXT_WEB
public
mixed
CONTEXT_WEB
= 'WEB'
IGNORED_HMAC_EXCEPTION_CODES
public
mixed
IGNORED_HMAC_EXCEPTION_CODES
= [
1581862822,
// Failed HMAC validation due to modified __trustedProperties in extbase property mapping
1581862823,
// Failed HMAC validation due to modified form state in ext:forms
1320830018,
// Failed HMAC validation due to modified HMAC string in Extbase HashService
1320830276,
// Failed HMAC validation due to too short HMAC string in Extbase HashService
1704454157,
// Failed HMAC validation due to modified HMAC string in Core HashService
1704454152,
]
IGNORED_EXCEPTION_CODES
protected
mixed
IGNORED_EXCEPTION_CODES
= [
1396795884,
// Current host header value does not match the configured trusted hosts pattern
1616175867,
// Backend login request is rate limited
1616175847,
// Frontend login request is rate limited
1436717275,
// Request with unsupported HTTP method
1699604555,
// Outdated __trustedProperties format in extbase property mapping
1517949792,
// The IP address of your client does not match the list of allowed IP addresses
1517949793,
// Backend access by browser is locked for maintenance
1517949794,
// Backend and Install Tool are locked for maintenance
1436717270,
// Client sends a header with an invalid name
1436717269,
]
Properties
$logExceptionStackTrace
protected
bool
$logExceptionStackTrace
= true
Methods
__construct()
Constructs this exception handler - registers itself as the default exception handler.
public
__construct() : mixed
echoExceptionCLI()
Formats and echoes the exception for the command line
public
echoExceptionCLI(Throwable $exception) : mixed
Parameters
- $exception : Throwable
-
The throwable object.
echoExceptionWeb()
Formats and echoes the exception as XHTML.
public
echoExceptionWeb(Throwable $exception) : mixed
Parameters
- $exception : Throwable
-
The throwable object.
handleException()
Displays the given exception
public
handleException(Throwable $exception) : mixed
Parameters
- $exception : Throwable
-
The throwable object.
Tags
anonymizeToken()
Replaces the generated token with a generic equivalent
protected
anonymizeToken(string $requestedUrl) : string
Parameters
- $requestedUrl : string
Return values
stringescapeHtml()
protected
escapeHtml(string $str) : string
Parameters
- $str : string
Return values
stringflattenArgs()
protected
flattenArgs(array<string|int, mixed> $args[, int $level = 0 ][, int &$count = 0 ]) : array<string|int, mixed>
Parameters
- $args : array<string|int, mixed>
- $level : int = 0
- $count : int = 0
Return values
array<string|int, mixed>formatArgs()
Formats the arguments of a method call.
protected
formatArgs(array<string|int, mixed> $args) : string
Parameters
- $args : array<string|int, mixed>
-
The flattened args of method/function call
Return values
stringformatPath()
Formats a path adding a line number.
protected
formatPath(string $path, int $line) : string
Parameters
- $path : string
-
The full path of the file.
- $line : int
-
The line number.
Return values
stringgetAllThrowables()
protected
getAllThrowables(Throwable $throwable) : array<string|int, mixed>
Parameters
- $throwable : Throwable
Return values
array<string|int, mixed>getBackendUser()
protected
getBackendUser() : BackendUserAuthentication|null
Return values
BackendUserAuthentication|nullgetBacktraceCode()
Renders the backtrace as HTML.
protected
getBacktraceCode(array<string|int, mixed> $trace) : string
Parameters
- $trace : array<string|int, mixed>
Return values
stringgetClassNameFromIncomplete()
protected
getClassNameFromIncomplete(__PHP_Incomplete_Class $value) : string
Parameters
- $value : __PHP_Incomplete_Class
Return values
stringgetCodeSnippet()
Returns a code snippet from the specified file.
protected
getCodeSnippet(string $filePathAndName, int $lineNumber) : string
Parameters
- $filePathAndName : string
-
Absolute path and file name of the PHP file
- $lineNumber : int
-
Line number defining the center of the code snippet
Return values
string —The code snippet
getContent()
Generates the HTML for the error output.
protected
getContent(Throwable $throwable) : string
Parameters
- $throwable : Throwable
Return values
stringgetSingleThrowableContent()
Renders the HTML for a single throwable.
protected
getSingleThrowableContent(Throwable $throwable, int $index, int $total) : string
Parameters
- $throwable : Throwable
- $index : int
- $total : int
Return values
stringgetStylesheet()
Generates the stylesheet needed to display the error page.
protected
getStylesheet() : string
Return values
stringgetTypo3LogoAsSvg()
protected
getTypo3LogoAsSvg() : string
Return values
stringsendStatusHeaders()
Sends the HTTP Status 500 code, if $exception is *not* a TYPO3\CMS\Core\Error\Http\StatusException and headers are not sent, yet.
protected
sendStatusHeaders(Throwable $exception) : mixed
Parameters
- $exception : Throwable
-
The throwable object.
writeLog()
Writes an exception in the sys_log table
protected
writeLog(string $logMessage) : mixed
Parameters
- $logMessage : string
-
Default text that follows the message.
writeLogEntries()
Writes exception to different logs
protected
writeLogEntries(Throwable $exception, string $mode) : void
Parameters
- $exception : Throwable
-
The throwable object.
- $mode : string
-
The context where the exception was thrown. Either self::CONTEXT_WEB or self::CONTEXT_CLI.