Skip to content

Commit

Permalink
Merge pull request #7488 from marekmosna/7484-postgresql-server-version
Browse files Browse the repository at this point in the history
fix: PostgreSQL getVersion() logic
  • Loading branch information
kenjis authored May 21, 2023
2 parents 61df4df + 4c6e4ec commit d334a2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ parameters:
count: 3
path: system/Database/MySQLi/PreparedQuery.php

-
message: "#^Strict comparison using \\=\\=\\= between array<string, int|string|null> and false will always evaluate to false\\.$#"
count: 1
path: system/Database/Postgre/Connection.php

-
message: "#^Access to an undefined property CodeIgniter\\\\Database\\\\BaseConnection\\:\\:\\$schema\\.$#"
count: 2
Expand Down
7 changes: 5 additions & 2 deletions system/Database/Postgre/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,14 @@ public function getVersion(): string
return $this->dataCache['version'];
}

if (! $this->connID || ($pgVersion = pg_version($this->connID)) === false) {
if (! $this->connID) {
$this->initialize();
}

return isset($pgVersion['server']) ? $this->dataCache['version'] = $pgVersion['server'] : false;
$pgVersion = pg_version($this->connID);
$this->dataCache['version'] = $pgVersion['server'] ?? '';

return $this->dataCache['version'];
}

/**
Expand Down

0 comments on commit d334a2a

Please sign in to comment.