[BUGFIX] Ensure connection can be established multiple times 96/58196/2
authorNicole Cordes <typo3@cordes.co>
Wed, 5 Sep 2018 11:45:02 +0000 (13:45 +0200)
committerMathias Brodala <mbrodala@pagemachine.de>
Thu, 27 Sep 2018 13:38:00 +0000 (15:38 +0200)
This patch ensures a connection can be established multiple times
and is initialized correctly using the init commands on each fresh
connection call.

Resolves: #86154
Releases: master, 8.7
Change-Id: Ief2fb0855715333b124e8315c5f794008a5fb3d5
Reviewed-on: https://review.typo3.org/58196
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
typo3/sysext/core/Classes/Database/Connection.php

index 9757ff9..b68d088 100644 (file)
@@ -62,14 +62,6 @@ class Connection extends \Doctrine\DBAL\Connection
     private $prepareConnectionCommands = [];
 
     /**
-     * Prevents the duplicate registration of event handlers and types for this connection.
-     * If true the events will not be initialized any more in the getDatabasePlatform() method.
-     *
-     * @var bool
-     */
-    private $customConnectSetupExecuted = false;
-
-    /**
      * Initializes a new instance of the Connection class.
      *
      * @param array $params The connection parameters.
@@ -93,7 +85,7 @@ class Connection extends \Doctrine\DBAL\Connection
     public function connect(): bool
     {
         // Early return if the connection is already open and custom setup has been done.
-        if ($this->customConnectSetupExecuted || !parent::connect()) {
+        if (!parent::connect()) {
             return false;
         }
 
@@ -107,8 +99,6 @@ class Connection extends \Doctrine\DBAL\Connection
             }
         }
 
-        $this->customConnectSetupExecuted = true;
-
         return true;
     }