Bug #103708
closedMetaDataRepository->update() can't erase column content
100%
Description
Right now it is not possible in v12.4 or v13.x to call the method to erase the content of a field.
This worked fine in v10 and 11.
Given: A record exists with a copyright value. A new update is executed with an empty value for copyright.
I would expect the copyright to be empty. Instead, it still has the old value.
That's our code:
$this->metaDataRepository->update($file->getUid(), [
'title' => $this->getShortenedString($mediaObject['value'], 100),
'description' => $mediaObject['description'] ?? '',
'alternative' => $mediaObject['description'] ?? '',
'creator_tool' => 'destination.one',
'source' => $mediaObject['url'] ?? '',
'copyright' => $mediaObject['source'] ?? '',
]);
The $updateRow = array_diff($updateRow, $metaDataFromDatabase);
removed the empty value.
Updated by Daniel Siepmann 7 months ago
From my understanding TYPO3 should not use `array_diff` as this doesn't work as the code should work. It will only compare values, not combination of keys and values.
That should also result in further issues. E.g. given an existing record with a title of some value, it should be impossible to update the description to the same value, as this should be stripped out.
So what happens in our case is that there is some other existing empty value, that's why the diff removes empty copyright.
Updated by Gerrit Code Review 7 months ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84000
Updated by Gerrit Code Review 7 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84000
Updated by Gerrit Code Review 7 months ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84000
Updated by Gerrit Code Review 7 months ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84000
Updated by Gerrit Code Review 7 months ago
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84000
Updated by Gerrit Code Review 7 months ago
Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84000
Updated by Gerrit Code Review 7 months ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/84012
Updated by Daniel Siepmann 7 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 005f04a3b4c4e0450cc17e4b23aaeb92c5aac5ad.