[BUGFIX] Prevent enforcing opened database connection with initCommands 58/55558/5
authorNicole Cordes <typo3@cordes.co>
Sun, 4 Feb 2018 11:20:05 +0000 (12:20 +0100)
committerNicole Cordes <typo3@cordes.co>
Tue, 6 Feb 2018 10:01:44 +0000 (11:01 +0100)
commit6269d46a4a4ec2f3f8f7cd142b38d10fe476e695
tree14572cea98ce9847f0c90d69c4a4c03a8ffeffeb
parentdf6e4e261dc2a2da99bbcacc15cd4d6b86cef7b8
[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 <no-reply@typo3.com>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/core/Classes/Database/Connection.php
typo3/sysext/core/Tests/Functional/Error/ErrorHandlerTest.php [new file with mode: 0644]