Skip to content

Commit

Permalink
Fix phpversion() returning false when an extension has no version, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek authored and emahorvat52 committed Jan 18, 2023
1 parent fd87ed7 commit 5e9759d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 6 additions & 1 deletion src/Composer/Platform/Runtime.php
Expand Up @@ -98,7 +98,12 @@ public function getExtensions(): array
*/
public function getExtensionVersion(string $extension): string
{
return phpversion($extension);
$version = phpversion($extension);
if ($version === false) {
$version = '0';
}

return $version;
}

/**
Expand Down
7 changes: 1 addition & 6 deletions src/Composer/Repository/PlatformRepository.php
Expand Up @@ -618,13 +618,8 @@ private function addDisabledPackage(CompletePackage $package): void

/**
* Parses the version and adds a new package to the repository
*
* @param string $name
* @param null|string $prettyVersion
*
* @return void
*/
private function addExtension(string $name, ?string $prettyVersion): void
private function addExtension(string $name, string $prettyVersion): void
{
$extraDescription = null;

Expand Down

0 comments on commit 5e9759d

Please sign in to comment.