diff --git a/apps/federation/lib/DbHandler.php b/apps/federation/lib/DbHandler.php index 3b88ffeabd55..0878e2471a82 100644 --- a/apps/federation/lib/DbHandler.php +++ b/apps/federation/lib/DbHandler.php @@ -293,6 +293,9 @@ protected function hash($url) { * @return string */ protected function normalizeUrl($url) { + if ($url === null) { + $url = ''; + } $normalized = $url; if (\strpos($url, 'https://') === 0) { diff --git a/changelog/unreleased/41597 b/changelog/unreleased/41597 new file mode 100644 index 000000000000..a6f1182b735c --- /dev/null +++ b/changelog/unreleased/41597 @@ -0,0 +1,7 @@ +Fix: Adjust code to avoid PHP8 messages + +Avoid trying to access array offset on false in the encryption storage wrapper. + +Handle passing null to normalizeUrl in the federation DbHandler. + +https://github.com/owncloud/core/pull/41597 diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index d3697f1b9a5e..6131ec45b226 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -472,7 +472,7 @@ public function fopen($path, $mode) { if (!empty($encryptionModuleId)) { $encryptionModule = $this->encryptionManager->getEncryptionModule($encryptionModuleId); $shouldEncrypt = true; - } elseif (empty($encryptionModuleId) && $info['encrypted'] === true) { + } elseif ($info !== false && $info->isEncrypted()) { // we come from a old installation. No header and/or no module defined // but the file is encrypted. In this case we need to use the // OC_DEFAULT_MODULE to read the file