Skip to content

Commit 533e180

Browse files
authored
Merge pull request #34937 from nextcloud/fix/do-not-crash-on-extension-without-version
Avoid a crash when a PHP extension has no version
2 parents 070ae29 + 7af4fea commit 533e180

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/private/App/PlatformRepository.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ protected function initialize(): array {
5050
$ext = new \ReflectionExtension($name);
5151
try {
5252
$prettyVersion = $ext->getVersion();
53-
$prettyVersion = $this->normalizeVersion($prettyVersion);
53+
/** @psalm-suppress TypeDoesNotContainNull
54+
* @psalm-suppress RedundantCondition
55+
* TODO Remove these annotations once psalm fixes the method signature ( https://github.com/vimeo/psalm/pull/8655 )
56+
*/
57+
$prettyVersion = $this->normalizeVersion($prettyVersion ?? '0');
5458
} catch (\UnexpectedValueException $e) {
5559
$prettyVersion = '0';
5660
$prettyVersion = $this->normalizeVersion($prettyVersion);
@@ -111,6 +115,9 @@ protected function initialize(): array {
111115
continue 2;
112116
}
113117

118+
if ($prettyVersion === null) {
119+
continue;
120+
}
114121
try {
115122
$prettyVersion = $this->normalizeVersion($prettyVersion);
116123
} catch (\UnexpectedValueException $e) {

0 commit comments

Comments
 (0)