Skip to content

Commit a9d3918

Browse files
authored
fix: catch new type error being thrown (#41504)
This is a new error that is thrown due to the update to php 8.3
1 parent 04fbcb0 commit a9d3918

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

apps/files_trashbin/lib/Storage.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,17 @@ public function retainKeys($filename, $owner, $ownerPath, $timestamp, $sourceSto
230230
if ($sourceStorage !== null) {
231231
$sourcePath = '/' . $owner . '/files_trashbin/files/'. $filename . '.d' . $timestamp;
232232
$targetPath = '/' . $owner . '/files/' . $ownerPath;
233-
return $sourceStorage->copyKeys($sourcePath, $targetPath);
233+
try {
234+
return $sourceStorage->copyKeys($sourcePath, $targetPath);
235+
} catch (\TypeError $e) {
236+
// FIXME: The copyKeys method isn't fully implemented in all the storages / wrappers.
237+
// The call will likely trigger this error if the OC\Files\Storage\Wrapper\Encryption
238+
// isn't part if the wrappers in the $sourceStorage.
239+
// In PHP 7.4, this error was ignored and logged, but in PHP 8.3 it throws an
240+
// exception that breaks the code execution.
241+
// For the short term, we'll keep the previous behavior and catch the exception here.
242+
return false;
243+
}
234244
}
235245
}
236246
return false;

0 commit comments

Comments
 (0)