summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon L <szaimen@e.mail.de>2022-11-07 10:45:44 +0100
committerGitHub <noreply@github.com>2022-11-07 10:45:44 +0100
commit533e1803cf2746c25ce1ead7a3cd02940716458f (patch)
treef791c1369d5d65b3b0b4cd745a7e708fa458d00d
parent070ae2930c5662ab3de6570f6643213b1df1e4f3 (diff)
parent7af4fea0e3a41f160b83bd48ae16c31b651f9cf1 (diff)
downloadnextcloud-server-533e1803cf2746c25ce1ead7a3cd02940716458f.tar.gz
nextcloud-server-533e1803cf2746c25ce1ead7a3cd02940716458f.zip
Merge pull request #34937 from nextcloud/fix/do-not-crash-on-extension-without-version
Avoid a crash when a PHP extension has no version
-rw-r--r--lib/private/App/PlatformRepository.php9
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) {