Project

General

Profile

Actions

Bug #103708

closed

MetaDataRepository->update() can't erase column content

Added by Daniel Siepmann 7 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2024-04-23
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.

Actions #1

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.

Actions #2

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

Actions #3

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

Actions #4

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

Actions #5

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

Actions #6

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

Actions #7

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

Actions #8

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

Actions #9

Updated by Daniel Siepmann 7 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #10

Updated by Daniel Siepmann 7 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF