From 33a65ca9cd50adbb05d2d1ad901991f045d6f3e5 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 24 Nov 2023 13:50:59 +0100 Subject: [PATCH] fix detecting the database server version --- .../Component/Cache/Adapter/DoctrineDbalAdapter.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/Cache/Adapter/DoctrineDbalAdapter.php b/src/Symfony/Component/Cache/Adapter/DoctrineDbalAdapter.php index a298697106409..d0ff0e55eb377 100644 --- a/src/Symfony/Component/Cache/Adapter/DoctrineDbalAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/DoctrineDbalAdapter.php @@ -421,17 +421,14 @@ private function getServerVersion(): string return $this->serverVersion; } - if ($this->conn instanceof ServerVersionProvider) { - return $this->conn->getServerVersion(); + if ($this->conn instanceof ServerVersionProvider || $this->conn instanceof ServerInfoAwareConnection) { + return $this->serverVersion = $this->conn->getServerVersion(); } // The condition should be removed once support for DBAL <3.3 is dropped $conn = method_exists($this->conn, 'getNativeConnection') ? $this->conn->getNativeConnection() : $this->conn->getWrappedConnection(); - if ($conn instanceof ServerInfoAwareConnection) { - return $this->serverVersion = $conn->getServerVersion(); - } - return $this->serverVersion = '0'; + return $this->serverVersion = $conn->getAttribute(\PDO::ATTR_SERVER_VERSION); } private function addTableToSchema(Schema $schema): void