Skip to content

Commit e70375b

Browse files
committed
fix(Files): Change how scanner diffs for changed metadata
Fixes #43408 Signed-off-by: Josh <josh.t.richards@gmail.com>
1 parent e0705f1 commit e70375b

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

lib/private/Files/Cache/Scanner.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,17 @@ public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData =
221221
}
222222

223223
// Only update metadata that has changed
224-
$newData = array_diff_assoc($data, $cacheData->getData());
225-
224+
// i.e. get all the values in $data that are not present in the cache already
225+
// NOTE: we serialize then unserialize here because array_diff_assoc() doesn't
226+
// support multidimensional arrays on its own (and otherwise internally casts any
227+
// embedded array elements to attempt to compare them - not only generating warnings
228+
// like "Array to string conversion" but also, as a resut, overlooking real differences)
229+
$newData = array_diff_assoc(
230+
array_map('serialize', $data),
231+
array_map('serialize', $cacheData->getData())
232+
);
233+
$newData = array_map('unserialize', $newData);
234+
226235
// make it known to the caller that etag has been changed and needs propagation
227236
if (isset($newData['etag'])) {
228237
$data['etag_changed'] = true;

0 commit comments

Comments
 (0)