DebugExceptionHandler

class \TYPO3\CMS\Core\Error\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  : mixed = 'CLI'
CONTEXT_WEB  : mixed = 'WEB'
IGNORED_HMAC_EXCEPTION_CODES  : mixed = [ 1581862822, // Failed HMAC validation due to...
IGNORED_EXCEPTION_CODES  : mixed = [ 1396795884, // Current host header value does...

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
formatArgs()  : string
Formats the arguments of a method call.
formatPath()  : string
Formats a path adding a line number.
getAllThrowables()  : array
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 modif…
Show the full value[ 1581862822, // Failed HMAC validation due to modified __trustedProperties in extbase property mapping 1581862823, ]

IGNORED_EXCEPTION_CODES

protected mixed IGNORED_EXCEPTION_CODES = [ 1396795884, // Current host header value does not …
Show the full value[ 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, ]

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

throws
Exception

anonymizeToken()

Replaces the generated token with a generic equivalent

protected anonymizeToken(string $requestedUrl) : string

Parameters

$requestedUrl : string

Return values

string

escapeHtml()

protected escapeHtml(string $str) : string

Parameters

$str : string

Return values

string

flattenArgs()

protected flattenArgs(array $args[, int $level = 0 ][, int &$count = 0 ]) : array

Parameters

$args : array
$level : int = 0
$count : int = 0

Return values

array

formatArgs()

Formats the arguments of a method call.

protected formatArgs(array $args) : string

Parameters

$args : array

The flattened args of method/function call

Return values

string

formatPath()

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

string

getAllThrowables()

protected getAllThrowables(Throwable $throwable) : array

Parameters

$throwable : Throwable

Return values

array

getBacktraceCode()

Renders the backtrace as HTML.

protected getBacktraceCode(array $trace) : string

Parameters

$trace : array

Return values

string

getClassNameFromIncomplete()

protected getClassNameFromIncomplete(__PHP_Incomplete_Class $value) : string

Parameters

$value : __PHP_Incomplete_Class

Return values

string

getCodeSnippet()

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

string

getSingleThrowableContent()

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

string

getStylesheet()

Generates the stylesheet needed to display the error page.

protected getStylesheet() : string

Return values

string

getTypo3LogoAsSvg()

protected getTypo3LogoAsSvg() : string

Return values

string

sendStatusHeaders()

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.

On this page