[BUGFIX] Prevent enforcing opened database connection with initCommands 48/55548/8
authorNicole Cordes <typo3@cordes.co>
Sun, 4 Feb 2018 11:20:05 +0000 (12:20 +0100)
committerHelmut Hummel <typo3@helhum.io>
Sun, 4 Feb 2018 22:10:28 +0000 (23:10 +0100)
commit6fbefa628fb9cd52f8a8e7c0f0ec87bdb88c3b4f
tree003b81f0203957083fcb224cf3e5c09b02f2bb22
parentc950cdefaa16ea08225f7dec8eed32cf3c162e99
[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 <no-reply@typo3.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Helmut Hummel <typo3@helhum.io>
Tested-by: Helmut Hummel <typo3@helhum.io>
typo3/sysext/core/Classes/Database/Connection.php
typo3/sysext/core/Tests/Functional/Error/ErrorHandlerTest.php [new file with mode: 0644]