Skip to content

Commit 5f942a9

Browse files
bug symfony#52715 [Cache] fix detecting the database server version (xabbuh)
This PR was merged into the 5.4 branch. Discussion ---------- [Cache] fix detecting the database server version | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | symfony#52685 (comment) | License | MIT Commits ------- 33a65ca fix detecting the database server version
2 parents 12845ab + 33a65ca commit 5f942a9

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Symfony/Component/Cache/Adapter/DoctrineDbalAdapter.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -421,17 +421,14 @@ private function getServerVersion(): string
421421
return $this->serverVersion;
422422
}
423423

424-
if ($this->conn instanceof ServerVersionProvider) {
425-
return $this->conn->getServerVersion();
424+
if ($this->conn instanceof ServerVersionProvider || $this->conn instanceof ServerInfoAwareConnection) {
425+
return $this->serverVersion = $this->conn->getServerVersion();
426426
}
427427

428428
// The condition should be removed once support for DBAL <3.3 is dropped
429429
$conn = method_exists($this->conn, 'getNativeConnection') ? $this->conn->getNativeConnection() : $this->conn->getWrappedConnection();
430-
if ($conn instanceof ServerInfoAwareConnection) {
431-
return $this->serverVersion = $conn->getServerVersion();
432-
}
433430

434-
return $this->serverVersion = '0';
431+
return $this->serverVersion = $conn->getAttribute(\PDO::ATTR_SERVER_VERSION);
435432
}
436433

437434
private function addTableToSchema(Schema $schema): void

0 commit comments

Comments
 (0)