Bug #82795

Page unavailable handling broken in connectToDB of TypoScriptFrontendController

Added by Alexander Stehlik over 2 years ago. Updated over 1 year ago.

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

100%

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

Related to TYPO3 Core - Bug #83577: Database analyzer: Error message by usage of enums Closed 2018-01-16
Related to TYPO3 Core - Bug #86154: DatabaseConnection does not reset internal state on close() Closed 2018-09-05

Associated revisions

Revision 8c40079d (diff)
Added by Alexander Stehlik over 2 years ago

[BUGFIX] Move doctrine initalization to connect() method

The event and custom type initalization of doctrine is moved
to an overwritten connect() method in the Connection class.

This prevents a premature establishment of a database connection
by calls to getDatabasePlatform().

This fixes the page unavailable during the connectToDB() in
the Frontend request handling.

Change-Id: Id6087002c7cbb9ed3938c4627d63b77515a7108f
Releases: master, 8.7
Resolves: #82795
Reviewed-on: https://review.typo3.org/54432
Tested-by: TYPO3com <>
Reviewed-by: Morton Jonuschat <>
Tested-by: Morton Jonuschat <>
Reviewed-by: Jigal van Hemert <>
Tested-by: Jigal van Hemert <>

Revision 84f25525 (diff)
Added by Alexander Stehlik over 2 years ago

[BUGFIX] Move doctrine initalization to connect() method

The event and custom type initalization of doctrine is moved
to an overwritten connect() method in the Connection class.

This prevents a premature establishment of a database connection
by calls to getDatabasePlatform().

This fixes the page unavailable during the connectToDB() in
the Frontend request handling.

Change-Id: Id6087002c7cbb9ed3938c4627d63b77515a7108f
Releases: master, 8.7
Resolves: #82795
Reviewed-on: https://review.typo3.org/54512
Tested-by: TYPO3com <>
Reviewed-by: Alexander Stehlik <>
Tested-by: Alexander Stehlik <>
Reviewed-by: Joerg Boesche <>
Reviewed-by: Andreas Wolf <>
Tested-by: Andreas Wolf <>

Revision ba5b5242 (diff)
Added by Alexander Stehlik about 2 years ago

[BUGFIX] Move Doctrine custom type init back to ConnectionPool

To prevent race conditions etc. the custom type init which was moved
in patch https://review.typo3.org/#/c/54512/ gets reverted.

To fix the issue with the pageUnavailable_handling the method
TyposriptFrontendController::connectToDB handles the error correctly via
try catch block.

Change-Id: I4f410d82e54c182d7b032a8ab4486d5b3b859382
Releases: master, 8.7
Resolves: #83577
Related: #82795
Reviewed-on: https://review.typo3.org/55379
Tested-by: TYPO3com <>
Reviewed-by: Anja Leichsenring <>
Tested-by: Anja Leichsenring <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

Revision c6a630bc (diff)
Added by Alexander Stehlik about 2 years ago

[BUGFIX] Move Doctrine custom type init back to ConnectionPool

To prevent race conditions etc. the custom type init which was moved
in patch https://review.typo3.org/#/c/54512/ gets reverted.

To fix the issue with the pageUnavailable_handling the method
TyposriptFrontendController::connectToDB handles the error correctly via
try catch block.

Change-Id: I4f410d82e54c182d7b032a8ab4486d5b3b859382
Releases: master, 8.7
Resolves: #83577
Related: #82795
Reviewed-on: https://review.typo3.org/56355
Tested-by: TYPO3com <>
Reviewed-by: Stefan Neufeind <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

History

#1 Updated by Gerrit Code Review over 2 years ago

  • Status changed from New to Under Review

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

#2 Updated by Gerrit Code Review over 2 years ago

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

#3 Updated by Gerrit Code Review over 2 years ago

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

#4 Updated by Alexander Stehlik over 2 years ago

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

#5 Updated by Gerrit Code Review over 2 years ago

  • Status changed from Resolved to Under Review

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/54512

#6 Updated by Alexander Stehlik over 2 years ago

  • Status changed from Under Review to Resolved

#7 Updated by Jasmina LieƟmann about 2 years ago

  • Related to Bug #83577: Database analyzer: Error message by usage of enums added

#8 Updated by Helmut Hummel over 1 year ago

  • Related to Bug #86154: DatabaseConnection does not reset internal state on close() added

#9 Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF