[ Index ]

PHP Cross Reference of phpBB-3.3.3-deutsch

title

Body

[close]

/vendor/symfony/debug/ -> ErrorHandler.php (summary)

(no description)

File Size: 787 lines (30 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ErrorHandler:: (17 methods):
  register()
  __construct()
  setDefaultLogger()
  setLoggers()
  setExceptionHandler()
  throwAt()
  scopeAt()
  traceAt()
  screamAt()
  reRegister()
  handleError()
  handleException()
  handleFatalError()
  stackErrors()
  unstackErrors()
  getFatalErrorHandlers()
  cleanTrace()


Class: ErrorHandler  - X-Ref

A generic ErrorHandler for the PHP engine.

Provides five bit fields that control how errors are handled:
- thrownErrors: errors thrown as \ErrorException
- loggedErrors: logged errors, when not @-silenced
- scopedErrors: errors thrown or logged with their local context
- tracedErrors: errors logged with their stack trace
- screamedErrors: never @-silenced errors

Each error level can be logged by a dedicated PSR-3 logger object.
Screaming only applies to logging.
Throwing takes precedence over logging.
Uncaught exceptions are logged as E_ERROR.
E_DEPRECATED and E_USER_DEPRECATED levels never throw.
E_RECOVERABLE_ERROR and E_USER_ERROR levels always throw.
Non catchable errors that can be detected at shutdown time are logged when the scream bit field allows so.
As errors have a performance cost, repeated errors are all logged, so that the developer
can see them and weight them as more important to fix than others of the same level.

register(self $handler = null, $replace = true)   X-Ref
Registers the error handler.

return: self The registered error handler
param: self|null $handler The handler to register
param: bool      $replace Whether to replace or not any existing handler

__construct(BufferingLogger $bootstrappingLogger = null)   X-Ref
No description

setDefaultLogger(LoggerInterface $logger, $levels = \E_ALL, $replace = false)   X-Ref
Sets a logger to non assigned errors levels.

param: LoggerInterface $logger  A PSR-3 logger to put as default for the given levels
param: array|int       $levels  An array map of E_* to LogLevel::* or an integer bit field of E_* constants
param: bool            $replace Whether to replace or not any existing logger

setLoggers(array $loggers)   X-Ref
Sets a logger for each error level.

return: array The previous map
param: array $loggers Error levels to [LoggerInterface|null, LogLevel::*] map

setExceptionHandler(callable $handler = null)   X-Ref
Sets a user exception handler.

return: callable|null The previous exception handler
param: callable $handler A handler that will be called on Exception

throwAt($levels, $replace = false)   X-Ref
Sets the PHP error levels that throw an exception when a PHP error occurs.

return: int The previous value
param: int  $levels  A bit field of E_* constants for thrown errors
param: bool $replace Replace or amend the previous value

scopeAt($levels, $replace = false)   X-Ref
Sets the PHP error levels for which local variables are preserved.

return: int The previous value
param: int  $levels  A bit field of E_* constants for scoped errors
param: bool $replace Replace or amend the previous value

traceAt($levels, $replace = false)   X-Ref
Sets the PHP error levels for which the stack trace is preserved.

return: int The previous value
param: int  $levels  A bit field of E_* constants for traced errors
param: bool $replace Replace or amend the previous value

screamAt($levels, $replace = false)   X-Ref
Sets the error levels where the @-operator is ignored.

return: int The previous value
param: int  $levels  A bit field of E_* constants for screamed errors
param: bool $replace Replace or amend the previous value

reRegister($prev)   X-Ref
Re-registers as a PHP error handler if levels changed.


handleError($type, $message, $file, $line)   X-Ref
Handles errors by filtering then logging them according to the configured bit fields.

return: bool Returns false when no handling happens so that the PHP engine can handle the error itself
param: int    $type    One of the E_* constants
param: string $message
param: string $file
param: int    $line

handleException($exception, array $error = null)   X-Ref
Handles an exception by logging then forwarding it to another handler.

param: \Exception|\Throwable $exception An exception to handle
param: array                 $error     An array as returned by error_get_last()

handleFatalError(array $error = null)   X-Ref
Shutdown registered function for handling PHP fatal errors.

param: array $error An array as returned by error_get_last()

stackErrors()   X-Ref
Configures the error handler for delayed handling.
Ensures also that non-catchable fatal errors are never silenced.

As shown by http://bugs.php.net/42098 and http://bugs.php.net/60724
PHP has a compile stage where it behaves unusually. To workaround it,
we plug an error handler that only stacks errors for later.

The most important feature of this is to prevent
autoloading until unstackErrors() is called.


unstackErrors()   X-Ref
Unstacks stacked errors and forwards to the logger.


getFatalErrorHandlers()   X-Ref
Gets the fatal error handlers.

Override this method if you want to define more fatal error handlers.

return: FatalErrorHandlerInterface[] An array of FatalErrorHandlerInterface

cleanTrace($backtrace, $type, $file, $line, $throw)   X-Ref
No description



Generated: Sun Feb 14 20:08:31 2021 Cross-referenced by PHPXref 0.7.1