aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2025-02-03 12:53:46 +0100
committerLouis Chemineau <louis@chmn.me>2025-02-26 10:28:39 +0100
commitcdd00bf803894848f93f7fc37f58e2ad0ce938e3 (patch)
treee63c54b94250d8986e351212a9fce44b863037d1
parent86f3b81de7cc2d9db48d54120fae315d80ad3f75 (diff)
downloadnextcloud-server-cdd00bf803894848f93f7fc37f58e2ad0ce938e3.tar.gz
nextcloud-server-cdd00bf803894848f93f7fc37f58e2ad0ce938e3.zip
fix: Report duplicated extra files in integrity checkartonge/fix/extra_files_integrity_check
The `array_diff` is not comparing the array keys. This means that an extra key with an expected hash will not be reported. Using `array_diff_assoc` will report such files. For example, copying `status.php` to `status 2.php`, will only be reported with the new version. Signed-off-by: Louis Chemineau <louis@chmn.me>
-rw-r--r--lib/private/IntegrityCheck/Checker.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/private/IntegrityCheck/Checker.php b/lib/private/IntegrityCheck/Checker.php
index 3a24e8632de..361fe8e9b2d 100644
--- a/lib/private/IntegrityCheck/Checker.php
+++ b/lib/private/IntegrityCheck/Checker.php
@@ -335,8 +335,8 @@ class Checker {
// Compare the list of files which are not identical
$currentInstanceHashes = $this->generateHashes($this->getFolderIterator($basePath), $basePath);
- $differencesA = array_diff($expectedHashes, $currentInstanceHashes);
- $differencesB = array_diff($currentInstanceHashes, $expectedHashes);
+ $differencesA = array_diff_assoc($expectedHashes, $currentInstanceHashes);
+ $differencesB = array_diff_assoc($currentInstanceHashes, $expectedHashes);
$differences = array_unique(array_merge($differencesA, $differencesB));
$differenceArray = [];
foreach ($differences as $filename => $hash) {