Skip to content

Commit

Permalink
Use global constant if available for libpq version
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed Oct 11, 2023
1 parent d2bd983 commit 53bd381
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Composer/Repository/PlatformRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,14 @@ protected function initialize(): void

case 'pgsql':
case 'pdo_pgsql':
$info = $this->runtime->getExtensionInfo($name);
if (defined('PGSQL_LIBPQ_VERSION')) {
$this->addLibrary($name.'-libpq', PGSQL_LIBPQ_VERSION, 'libpq for '.$name);
} else {
$info = $this->runtime->getExtensionInfo($name);

if (Preg::isMatch('/^PostgreSQL\(libpq\) Version => (?<version>.*)$/im', $info, $matches)) {
$this->addLibrary($name.'-libpq', $matches['version'], 'libpq for '.$name);
if (Preg::isMatch('/^PostgreSQL\(libpq\) Version => (?<version>.*)$/im', $info, $matches)) {
$this->addLibrary($name.'-libpq', $matches['version'], 'libpq for '.$name);
}
}
break;

Expand Down

0 comments on commit 53bd381

Please sign in to comment.