Skip to content

Commit

Permalink
Merge pull request #35005 from nextcloud/backport/34937/stable24
Browse files Browse the repository at this point in the history
[stable24] Avoid a crash when a PHP extension has no version
  • Loading branch information
szaimen authored Nov 7, 2022
2 parents 3e97bee + 9d377a1 commit 29e31f4
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 @@ -48,7 +48,11 @@ protected function initialize() {
$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 @@ -109,6 +113,9 @@ protected function initialize() {
continue 2;
}

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

0 comments on commit 29e31f4

Please sign in to comment.