Skip to content

Commit 29e31f4

Browse files
authored
Merge pull request #35005 from nextcloud/backport/34937/stable24
[stable24] Avoid a crash when a PHP extension has no version
2 parents 3e97bee + 9d377a1 commit 29e31f4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

lib/private/App/PlatformRepository.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ protected function initialize() {
4848
$ext = new \ReflectionExtension($name);
4949
try {
5050
$prettyVersion = $ext->getVersion();
51-
$prettyVersion = $this->normalizeVersion($prettyVersion);
51+
/** @psalm-suppress TypeDoesNotContainNull
52+
* @psalm-suppress RedundantCondition
53+
* TODO Remove these annotations once psalm fixes the method signature ( https://github.com/vimeo/psalm/pull/8655 )
54+
*/
55+
$prettyVersion = $this->normalizeVersion($prettyVersion ?? '0');
5256
} catch (\UnexpectedValueException $e) {
5357
$prettyVersion = '0';
5458
$prettyVersion = $this->normalizeVersion($prettyVersion);
@@ -109,6 +113,9 @@ protected function initialize() {
109113
continue 2;
110114
}
111115

116+
if ($prettyVersion === null) {
117+
continue;
118+
}
112119
try {
113120
$prettyVersion = $this->normalizeVersion($prettyVersion);
114121
} catch (\UnexpectedValueException $e) {

0 commit comments

Comments
 (0)