Project

General

Profile

Actions

Bug #83770

closed

ErrorHandler is not triggered after first error anymore

Added by Nicole Cordes almost 7 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Database API (Doctrine DBAL)
Target version:
Start date:
2018-02-04
Due date:
% Done:

100%

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

Description

Prerequisites:

- 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 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 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)

Actions

Also available in: Atom PDF