Skip to content

Conversation

@mikelwohlschlegel
Copy link

This checks BackendUtility::getRecord before using it in array_merge to avoid an exception.

We had the following problem:
There seems to be a difference in processing a history rollback between v11 und v12.

Steps to reproduce:

  • Add a new container to a page
  • Add a new content element to the same page
  • Move the new content element into the new container
  • Go back to the history and rollback ALL this steps

v11 --> WORKS
v12 --> EXCEPTION

While step debugging, I found out that $datamap['tt_content'] in

if (empty($datamap['tt_content']) || $dataHandler->bypassAccessCheckForRecords) {
is empty in v11 and not empty in v12.
My guess is, that v12 processes every single step in v12, while v11 just deletes the newly added elements (not proofed).

I'm not sure if this can maybe cause some side affects? What is the intention of merging the arrays here?

if (!empty($record)) {
$incomingFieldArray = array_merge($record, $incomingFieldArray);
}
$incomingFieldArray = array_merge(BackendUtility::getRecord('tt_content', $id), $incomingFieldArray);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems you doing the same thing twice now?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IchHabRecht You're right. I forgot to delete the original line. The commit is updated. Thanks.

@mikelwohlschlegel mikelwohlschlegel force-pushed the bugfix/null-check-get-record-before-array-merge branch from 00a07c7 to 4503e99 Compare July 31, 2025 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants