Bug #82795
closedPage unavailable handling broken in connectToDB of TypoScriptFrontendController
100%
Description
Expected behavior¶
When the database is not available and a pageUnavailable_handling
is configured, the configured handler should be used to display the error.
Current behavior¶
You get the "Oops, an error occurred" Exception message.
The problem¶
The getConnectionForTable()
call in connectToDB()
which is outside the try / catch block already tries to establish a database connection. When this fails the Exception is not catched.
Possible solutions¶
Move getConnectionForTable()
¶
Move the getConnectionForTable()
method call inside the try catch block.
Downside: you can not print the database connection name in the Exception message
Move Connection initialization¶
The code that is currently executed in ConnectionPool::getDatabaseConnection()
should be moved to the Connection
in an overwritten connect()
method.
The problematic calls here are $conn->getDatabasePlatform()
which always cause the connection to be established.