Issue Bug Closed

#105765Recursive Copy: Incorrect l10n_source for translated sub level pages - "Unused elements in language comparison"

Denis Mir 12/04/24, 14:43 updated 08/12/25, 14:36

Description

So we got the following problem. We tried to recursive copy a translated page with 1 level of sub pages. We saw that in the page modules language comparison view we got for the copied page translation all content elements marked as “unused elements”.

This is the same behavior like here.

https://forge.typo3.org/issues/91752

A fix for the symptom is developed here -> https://review.typo3.org/c/Packages/TYPO3.CMS/+/71372

The reason for this behavior is the “l10n_source” for the copied translated page record is still set to the UID of the original default page record.

After some debugging I can say that the cause of this issue is in the DataHandler class in the method “\TYPO3\CMS\Core\DataHandling\DataHandler::int_pageTreeInfo”.

The method tries to hand back a sorted list of page uids for a root pid.

Sorting is done with the “sorting” field. BUT the problem is that default page records and connected translated page records share the same “sorting” value. This leads to database engines picking the order depending on DB implementation internals.

This leads to the sorting that you can see in the added screenshot.

From the screenshot I can already tell you that “8809” and “8805” will get copied incorrectly with their copied translation page records getting the incorrect “l10n_source” set.

This is due to “$CPtable = $this->int_pageTreeInfo([], $uid, (int)$this->copyTree, $theNewRootID);” getting the incorrect order in “\TYPO3\CMS\Core\DataHandling\DataHandler::copyPages” and “\TYPO3\CMS\Core\DataHandling\DataHandler::copySpecificPage” getting now called in the wrong order. So the original translated page record gets copied before the original default record which finally leads to the incorrect “l10n_source”.

In the end “\TYPO3\CMS\Core\DataHandling\DataHandler::int_pageTreeInfo” should in this case just take the “sys_language = 0” records into account which would solve the issue.

Reviews 4

Files 1

History 715

  1. Garvin Hicking commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2024-12-04T22:34:23+00:00" > 12/04/24, 22:34 </span>

    I am not much involved in the issue, but if its the same issue and a patch exists, is having a new issue for this helpful or could you add this as a comment to the existing one?

  2. Denis Mir commented <span data-processor="relativetime" data-value="2024-12-05T07:11:16+00:00" > 12/05/24, 07:11 </span>

    The issue #91752 or better the related fix https://review.typo3.org/c/Packages/TYPO3.CMS/+/71372 do not fix the cause of the problem they just patch the symptom being the crashing page module.

    The root problem is that while recursive copying some copied page translation records get the incorrect “l10n_source” set in the database. And this leads to the problem described in #91752 that the page module crashes (well it shows unused records) for this specific page translation record. So #91752 just fixes the symptom of the bug described here in #105765. I think the root cause should be fixed in the DataHandler as well. This is why I opened up the new ticket. I also commented this on the #91752.

  3. Garvin Hicking commented and changed status Needs Feedback Accepted <span data-processor="relativetime" data-value="2024-12-05T09:24:12+00:00" > 12/05/24, 09:24 </span>

    Thanks for the explanation, I’ll then leave this open for now and made a note in the gerrit patch :)

  4. Gerrit Code Review pushed patch set 1 for main to change 87452 status Accepted Under Review <span data-processor="relativetime" data-value="2024-12-11T16:44:10+00:00" > 12/11/24, 16:44 </span>

  5. Benni Mack commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2024-12-16T13:40:12+00:00" > 12/16/24, 13:40 </span>

    Applied in changeset commit:73b6fdd2d8b6cbe9f78ed89e285e25291c3abe37.

  6. Gerrit Code Review pushed patch set 2 for 12.4 to change 87507 status Resolved Under Review <span data-processor="relativetime" data-value="2024-12-16T13:43:30+00:00" > 12/16/24, 13:43 </span>

  7. Benni Mack commented and changed status Under Review Resolved <span data-processor="relativetime" data-value="2024-12-19T19:20:10+00:00" > 12/19/24, 19:20 </span>

    Applied in changeset commit:1578898640ae3940645c475e4f8d4dfa821528ec.