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 6163894573
commit 2b0bc2bb2c

View file

@ -48,7 +48,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);
@ -109,6 +109,9 @@ class PlatformRepository {
continue 2;
}
if ($prettyVersion === null) {
continue;
}
try {
$prettyVersion = $this->normalizeVersion($prettyVersion);
} catch (\UnexpectedValueException $e) {