Issue Bug Closed

#86154DatabaseConnection does not reset internal state on close()

Helmut Hummel 09/05/18, 13:42 updated 10/02/18, 10:28

Description

In connect() we set customConnectSetupExecuted to true, but this state is not reset when closing the connection.
This leads to the situation that when close() is called and after that connect(), that the connection is not properly
initialized any more, because of the early exit when internal state is set to true.

Steps to reproduce:

$connection->close();
$connection->connect();
$connection->select(['*'], 'be_users');

Expected result:
Query is executed

Actual result:
Fatal error: “Call to a member function query() on null”

The issue became more pressing with prioritizing the check for internal state over the parent::connect() call with #82795 respectively: https://review.typo3.org/#/c/54512/2/typo3/sysext/core/Classes/Database/Connection.php

Reviews 2