diff options
author | Simon L <szaimen@e.mail.de> | 2022-11-07 17:47:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-07 17:47:22 +0100 |
commit | 1b9866fa4518dd7349d2e6528596150cb8fa59e4 (patch) | |
tree | 0f5ead7b4ee164f45b136e1326847bb5e847b72d /lib | |
parent | c587979785719f78ebcc1151d149ae47217c4a31 (diff) | |
parent | 940311085441a7d7707959f81b553bf06b13c030 (diff) | |
download | nextcloud-server-1b9866fa4518dd7349d2e6528596150cb8fa59e4.tar.gz nextcloud-server-1b9866fa4518dd7349d2e6528596150cb8fa59e4.zip |
Merge pull request #34998 from nextcloud/backport/34937/stable25
[stable25] Avoid a crash when a PHP extension has no version
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/App/PlatformRepository.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/App/PlatformRepository.php b/lib/private/App/PlatformRepository.php index 4166c2ead03..9b94c0b07bc 100644 --- a/lib/private/App/PlatformRepository.php +++ b/lib/private/App/PlatformRepository.php @@ -50,7 +50,11 @@ class PlatformRepository { $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); @@ -111,6 +115,9 @@ class PlatformRepository { continue 2; } + if ($prettyVersion === null) { + continue; + } try { $prettyVersion = $this->normalizeVersion($prettyVersion); } catch (\UnexpectedValueException $e) { |