Avoid a crash when a PHP extension has no version

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2022-11-03 11:53:51 +01:00 committed by backportbot-nextcloud[bot]
parent c587979785
commit 2b2ec5e7f7

View file

@ -50,7 +50,7 @@ class PlatformRepository {
$ext = new \ReflectionExtension($name);
try {
$prettyVersion = $ext->getVersion();
$prettyVersion = $this->normalizeVersion($prettyVersion);
$prettyVersion = $this->normalizeVersion($prettyVersion ?? '0');
} catch (\UnexpectedValueException $e) {
$prettyVersion = '0';
$prettyVersion = $this->normalizeVersion($prettyVersion);
@ -111,6 +111,9 @@ class PlatformRepository {
continue 2;
}
if ($prettyVersion === null) {
continue;
}
try {
$prettyVersion = $this->normalizeVersion($prettyVersion);
} catch (\UnexpectedValueException $e) {