Skip to content

Commit

Permalink
Merge pull request #34937 from nextcloud/fix/do-not-crash-on-extensio…
Browse files Browse the repository at this point in the history
…n-without-version

Avoid a crash when a PHP extension has no version
  • Loading branch information
szaimen authored Nov 7, 2022
2 parents 070ae29 + 7af4fea commit 533e180
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/private/App/PlatformRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ protected function initialize(): array {
$ext = new \ReflectionExtension($name);
try {
$prettyVersion = $ext->getVersion();
$prettyVersion = $this->normalizeVersion($prettyVersion);
/** @psalm-suppress TypeDoesNotContainNull
* @psalm-suppress RedundantCondition
* TODO Remove these annotations once psalm fixes the method signature ( https://github.com/vimeo/psalm/pull/8655 )
*/
$prettyVersion = $this->normalizeVersion($prettyVersion ?? '0');
} catch (\UnexpectedValueException $e) {
$prettyVersion = '0';
$prettyVersion = $this->normalizeVersion($prettyVersion);
Expand Down Expand Up @@ -111,6 +115,9 @@ protected function initialize(): array {
continue 2;
}

if ($prettyVersion === null) {
continue;
}
try {
$prettyVersion = $this->normalizeVersion($prettyVersion);
} catch (\UnexpectedValueException $e) {
Expand Down

0 comments on commit 533e180

Please sign in to comment.