diff options
author | Louis Chemineau <louis@chmn.me> | 2025-02-03 12:53:46 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2025-02-26 13:23:02 +0000 |
commit | 3e95b60b5861829e5c47478ae067b7ae40495aa3 (patch) | |
tree | 3df6d4cf74e6aefb23ea459f05eb8e43f7645b4d | |
parent | a7d44a835753e9e16502286a00904b7f6c24c4c5 (diff) | |
download | nextcloud-server-backport/51050/stable28.tar.gz nextcloud-server-backport/51050/stable28.zip |
fix: Report duplicated extra files in integrity checkbackport/51050/stable28
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.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/private/IntegrityCheck/Checker.php b/lib/private/IntegrityCheck/Checker.php index d13a8e01c5b..31be8266e45 100644 --- a/lib/private/IntegrityCheck/Checker.php +++ b/lib/private/IntegrityCheck/Checker.php @@ -387,8 +387,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) { |