Skip to content

Commit

Permalink
bug #52715 [Cache] fix detecting the database server version (xabbuh)
Browse files Browse the repository at this point in the history
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        | #52685 (comment)
| License       | MIT

Commits
-------

33a65ca fix detecting the database server version
  • Loading branch information
nicolas-grekas committed Nov 24, 2023
2 parents 12845ab + 33a65ca commit 5f942a9
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/Symfony/Component/Cache/Adapter/DoctrineDbalAdapter.php
Expand Up @@ -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
Expand Down

0 comments on commit 5f942a9

Please sign in to comment.