Project

General

Profile

Bug #83770

Updated by Helmut Hummel over 6 years ago

Prerequisites: 

 - after finding the problem/solution, I know that you need to set some initCommands for your database connection 

 Given: 

 - some functional test that triggers deprecated functions in 9.0 and above 
 - the deprecated function triggers an error (using trigger_error) of kind E_USER_DEPRECATED 

 Actual: 

 - running the functional function test ends up with an error and the deprecation message (https://review.typo3.org/#/c/55548/3 and https://travis-ci.org/TYPO3-Solr/ext-solr/jobs/336002964) 

 Expected: 

 - the deprecation error should be caught by the \TYPO3\CMS\Core\Error\ErrorHandler and not trigger any "real" error 

 Analysis: 

 - everything every works as expected if no initCommands are configured for the current database connection 
 - if initCommands are configured, the connection is prepared with those commands and therefore connected 
 - the \TYPO3\CMS\Core\Error\ErrorHandler tries to write deprecation messages into sys_log by calling \TYPO3\CMS\Core\Error\ErrorHandler::writeLog 
 - writeLog fetches a database connection (still inside the ErrorHandler) that is opened by default (due to the configured initCommands) 
 - \Doctrine\DBAL\Driver\Mysqli\MysqliConnection sets and restores own php error handler in its __construct function (still in \TYPO3\CMS\Core\Error\ErrorHandler) 

 -> resetting an error handler inside another error handler causes weird behaviour and seems to remove the \TYPO3\CMS\Core\Error\ErrorHandler as well 

 Solution: 

 - we have to prevent to open connections by default if initCommands for a connections are configured 
 - those commands only need to be executed after the connection is really forces to be connected (opened)

Back