Bug #83770

ErrorHandler is not triggered after first error anymore

Added by Nicole Cordes about 2 years ago. Updated over 1 year ago.

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

100%

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)

Associated revisions

Revision 6fbefa62 (diff)
Added by Nicole Cordes about 2 years ago

[BUGFIX] Prevent enforcing opened database connection with initCommands

This patch moves the execution of configured initCommands to the end
of connect function. This prevents a database connection from being
opened by default due to the execution of commands right after class
initialization and still ensures a connection is configured properly
before first command execution.

Furthermore this patch adds a new functional test for the ErrorHandler.
The test uses some predefined initCommands to enforce the strict mode
of MySQL database to be set. Due to the predefined initCommands the
test failed before as the connection was forced to be opened. For
further information see the referenced forge ticket.

Resolves: #83770
Releases: master, 8.7
Change-Id: I2287600959b3ec06d338e26373562850307ce0b1
Reviewed-on: https://review.typo3.org/55548
Tested-by: TYPO3com <>
Reviewed-by: Mathias Schreiber <>
Tested-by: Mathias Schreiber <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Reviewed-by: Wouter Wolters <>
Reviewed-by: Helmut Hummel <>
Tested-by: Helmut Hummel <>

Revision fa01dca9 (diff)
Added by Nicole Cordes about 2 years ago

[BUGFIX] Improve ErrorHandlerTest handleErrorFetchesDeprecations

The patch decouples the ErrorHandler test from MySQL and some internal
deprecated function.

Related: #83770
Releases: master
Change-Id: Id3b9ed3486d0c5c8a4f6ba030a25f1f8aee75b97
Reviewed-on: https://review.typo3.org/55562
Tested-by: TYPO3com <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Reviewed-by: Frank Naegler <>
Tested-by: Frank Naegler <>

Revision 6269d46a (diff)
Added by Nicole Cordes about 2 years ago

[BUGFIX] Prevent enforcing opened database connection with initCommands

This patch moves the execution of configured initCommands to the end
of connect function. This prevents a database connection from being
opened by default due to the execution of commands right after class
initialization and still ensures a connection is configured properly
before first command execution.

Furthermore this patch adds a new functional test for the ErrorHandler.
The test uses some predefined initCommands to enforce UTF8 support to be
set. This isn't necessary but uses initCommands in a safe way. Due to
the predefined initCommands the test failed before as the connection was
forced to be opened. For further information see the referenced forge
ticket.

Resolves: #83770
Releases: master, 8.7
Change-Id: I2287600959b3ec06d338e26373562850307ce0b1
Reviewed-on: https://review.typo3.org/55558
Tested-by: TYPO3com <>
Reviewed-by: Nicole Cordes <>
Tested-by: Nicole Cordes <>

History

#1 Updated by Gerrit Code Review about 2 years ago

  • Status changed from New to Under Review

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55548

#2 Updated by Gerrit Code Review about 2 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55548

#3 Updated by Helmut Hummel about 2 years ago

  • Description updated (diff)

#4 Updated by Gerrit Code Review about 2 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55548

#5 Updated by Gerrit Code Review about 2 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55558

#6 Updated by Nicole Cordes about 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#7 Updated by Gerrit Code Review about 2 years ago

  • Status changed from Resolved to Under Review

Patch set 2 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55558

#8 Updated by Gerrit Code Review about 2 years ago

Patch set 3 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55558

#9 Updated by Gerrit Code Review about 2 years ago

Patch set 4 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55558

#10 Updated by Nicole Cordes about 2 years ago

  • Status changed from Under Review to Resolved

#11 Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF