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 6dfaa87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Composer/Repository/PlatformRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,12 @@ protected function initialize(): void
break;

case 'pgsql':
if ($this->runtime->hasConstant('PGSQL_LIBPQ_VERSION')) {
$this->addLibrary('pgsql-libpq', $this->runtime->getConstant('PGSQL_LIBPQ_VERSION'), 'libpq for pgsql');
break;
}
// intentional fall-through to next case...

case 'pdo_pgsql':
$info = $this->runtime->getExtensionInfo($name);

Expand Down
2 changes: 2 additions & 0 deletions tests/Composer/Test/Repository/PlatformRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,8 @@ public static function provideLibraryTestCases(): array
pgsql.ignore_notice => Off => Off
pgsql.log_notice => Off => Off',
['lib-pgsql-libpq' => '12.2'],
[],
[['PGSQL_LIBPQ_VERSION', null, '12.2']],
],
'pdo_pgsql' => [
'pdo_pgsql',
Expand Down

0 comments on commit 6dfaa87

Please sign in to comment.