Project

General

Profile

Actions

Bug #88444

closed

TYPO3 error handler ignores error_reporting level of php.ini

Added by Stephan Großberndt almost 5 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
System/Bootstrap/Configuration
Target version:
-
Start date:
2019-05-27
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

TYPO3 uses the PHP error handling function for deprecation messages since TYPO3 v9.0, but defining a error_reporting level in php.ini like

error_reporting = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED & ~E_STRICT

in order to ignore deprecation messages on a production server has no effect.

The deprecations are logged by calling trigger_error($message, E_USER_DEPRECATED) which leads to the php error handler being executed even if the currently configured error_reporting() would ignore E_USER_DEPRECATED messages.

The ErrorHandler only uses the value from [SYS][errorHandlerErrors] which does not offer an option to use the server defined error_reporting level of php.ini:

https://github.com/TYPO3/TYPO3.CMS/blob/v9.5.7/typo3/sysext/core/Classes/Error/ErrorHandler.php#L66

    /**
     * Registers this class as default error handler
     *
     * @param int $errorHandlerErrors The integer representing the E_* error level which should be
     */
    public function __construct($errorHandlerErrors)
    {
        $excludedErrors = E_COMPILE_WARNING | E_COMPILE_ERROR | E_CORE_WARNING | E_CORE_ERROR | E_PARSE | E_ERROR;
        // reduces error types to those a custom error handler can process
        $this->errorHandlerErrors = $errorHandlerErrors & ~$excludedErrors;
        set_error_handler([$this, 'handleError'], $this->errorHandlerErrors);
    }

https://github.com/TYPO3/TYPO3.CMS/blob/v9.5.7/typo3/sysext/core/Classes/Core/Bootstrap.php#L669

        $errorHandlerErrors = $GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandlerErrors'];
...

            $errorHandler = GeneralUtility::makeInstance($errorHandlerClassName, $errorHandlerErrors);

Using the server defined error_reporting level of php.ini could be achieved by e.g. allowing a value like server_error_reporting for ['SYS']['errorHandlerErrors'] which would lead to the value of error_reporting() being used in

https://github.com/TYPO3/TYPO3.CMS/blob/v9.5.7/typo3/sysext/core/Classes/Core/Bootstrap.php#L701

            $errorHandler = GeneralUtility::makeInstance($errorHandlerClassName, $errorHandlerErrors);


Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #89934: E_UER_DEPRECATED errors should be handled by the basic error reportingClosed2019-12-13

Actions
Actions

Also available in: Atom PDF