Project

General

Profile

Bug #88444

Updated by Stephan Großberndt almost 5 years ago

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

 <pre>error_reporting = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED & ~E_STRICT</pre> 

 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 effect on TYPO3 as @SystemEnvironmentBuilder.php@ resets 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@: to default during bootstrap: 

 https://github.com/TYPO3/TYPO3.CMS/blob/v9.5.7/typo3/sysext/core/Classes/Error/ErrorHandler.php#L66 
 <pre> 
     /** 
      * Registers this class as default Initialize basic error handler reporting. 
      * 
      * @param int $errorHandlerErrors The integer representing There are a lot of extensions that have no strict / notice / deprecated free 
      * ext_localconf or ext_tables. Since the E_* final error level which should reporting must be set up 
      * after those extension files are read, a default configuration is needed to 
      * suppress error reporting meanwhile during further bootstrap. 
      */ 
     public protected static function __construct($errorHandlerErrors) initializeBasicErrorReporting() 
     { 
         $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 Core should be notice free at least until this point ... 
         $this->errorHandlerErrors = $errorHandlerErrors error_reporting(E_ALL & ~$excludedErrors; 
         set_error_handler([$this, 'handleError'], $this->errorHandlerErrors); ~(E_STRICT | E_NOTICE | E_DEPRECATED)); 
     } 
 </pre> 

 https://github.com/TYPO3/TYPO3.CMS/blob/v9.5.7/typo3/sysext/core/Classes/Core/Bootstrap.php#L669 
 <pre> 
         $errorHandlerErrors = $GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandlerErrors']; 
 ... 

             $errorHandler = GeneralUtility::makeInstance($errorHandlerClassName, $errorHandlerErrors); 
 </pre> https://github.com/TYPO3/TYPO3.CMS/blob/v9.5.7/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php#L328 

 Using So although @ErrorHandler@ correctly fetches the server currently defined @error_reporting@ level of @php.ini@ could be achieved by calling @error_reporting()@ in https://github.com/TYPO3/TYPO3.CMS/blob/v9.5.7/typo3/sysext/core/Classes/Error/ErrorHandler.php#L108 e.g. allowing a value like @server_error_reporting@ for @['SYS']['errorHandlerErrors']@ which would lead disabling E_USER_DEPRECATED in php.ini has no effect. 

 If TYPO3 really needs 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 
 <pre> 
             $errorHandler = GeneralUtility::makeInstance($errorHandlerClassName, $errorHandlerErrors); 
 </pre> 
 suppress this during bootstrap (questionable) it should be reset once bootstrapping is finished.

Back