diff --git a/typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php b/typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php
index 895d23c3b90691d967b20b6b043ac26ef6566b45..364772ed13e037a02545992976213e1e38987e9e 100644
--- a/typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php
+++ b/typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php
@@ -176,7 +176,7 @@ class MetaDataRepository implements SingletonInterface
         if (array_key_exists('uid', $updateRow)) {
             unset($updateRow['uid']);
         }
-        $updateRow = array_diff($updateRow, $metaDataFromDatabase);
+        $updateRow = array_diff_assoc($updateRow, $metaDataFromDatabase);
         if ($updateRow === []) {
             // Nothing to update - return current database row
             return $metaDataFromDatabase;
diff --git a/typo3/sysext/core/Tests/Functional/Resource/Index/Fixtures/FileWithMetaData.csv b/typo3/sysext/core/Tests/Functional/Resource/Index/Fixtures/FileWithMetaData.csv
new file mode 100644
index 0000000000000000000000000000000000000000..42a9c945fd1543dafdd80f5ba867ed49f729a750
--- /dev/null
+++ b/typo3/sysext/core/Tests/Functional/Resource/Index/Fixtures/FileWithMetaData.csv
@@ -0,0 +1,6 @@
+"sys_file",,,,,,,,,,
+,"uid","pid","storage","identifier","folder_hash","name","identifier_hash","extension","mime_type","sha1"
+,1,0,1,"/bar/bla/foo.txt","d839c094d3294deb5b61cf7e0fe4f1cddaa96579","foo","84e70e8b11db88cea944e4d7be107092ab148b72","txt","text/plain","6e237d7c3e98387f924b81aada9b8d1f43f5eb5b"
+"sys_file_metadata",,,,,,,,,,
+,"uid","pid","crdate","file","sys_language_uid","title","description","l10n_parent","copyright",
+,1,0,1556435417,1,0,"Title for foo","FoDescription",0,"John Doe",
diff --git a/typo3/sysext/core/Tests/Functional/Resource/Index/MetaDataRepositoryTest.php b/typo3/sysext/core/Tests/Functional/Resource/Index/MetaDataRepositoryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..0f97071f49e644c88643e51c49ceacf873736986
--- /dev/null
+++ b/typo3/sysext/core/Tests/Functional/Resource/Index/MetaDataRepositoryTest.php
@@ -0,0 +1,49 @@
+<?php
+
+declare(strict_types=1);
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+namespace TYPO3\CMS\Core\Tests\Functional\Resource\Index;
+
+use PHPUnit\Framework\Attributes\Test;
+use TYPO3\CMS\Core\Resource\Index\MetaDataRepository;
+use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
+
+final class MetaDataRepositoryTest extends FunctionalTestCase
+{
+    protected array $coreExtensionsToLoad = ['filemetadata'];
+
+    #[Test]
+    public function canUpdateAnExistingFieldWithEmptyValue(): void
+    {
+        $this->importCSVDataSet(__DIR__ . '/Fixtures/FileWithMetaData.csv');
+        $subject = $this->get(MetaDataRepository::class);
+        $result = $subject->update(1, [
+            'copyright' => '',
+        ]);
+        self::assertSame('', $result['copyright']);
+    }
+
+    #[Test]
+    public function canUpdateAnExistingFieldWithNewValue(): void
+    {
+        $this->importCSVDataSet(__DIR__ . '/Fixtures/FileWithMetaData.csv');
+        $subject = $this->get(MetaDataRepository::class);
+        $result = $subject->update(1, [
+            'copyright' => 'Something New',
+        ]);
+        self::assertSame('Something New', $result['copyright']);
+    }
+}