Project

General

Profile

Actions

Bug #82795

closed

Page unavailable handling broken in connectToDB of TypoScriptFrontendController

Added by Alexander Stehlik over 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2017-10-18
Due date:
% Done:

100%

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

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.


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #83577: Database analyzer: Error message by usage of enumsClosed2018-01-16

Actions
Related to TYPO3 Core - Bug #86154: DatabaseConnection does not reset internal state on close()Closed2018-09-05

Actions
Actions

Also available in: Atom PDF