Bug #82032

Copying page containing tt_content irre elements causes error

Added by Tobi Kretschmann over 1 year ago. Updated 2 months ago.

Status:
Resolved
Priority:
Must have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2017-08-03
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

Description

If the content element has an inline relation to tt_content (PID is the same) and the parent page is copied and pasted, the following error message will be displayed.

'1: Repeated attempt to copy record "tt_content:17671" with override values' (see screenshot)

The TCA for tt_content used to reproduce it, is:

$additionalFields = [
    'parent_id'                 => [
        'config' => [
            'type' => 'passthrough',
        ]
    ],
    'item' => [
        'exclude'    => 0,
        'label'      => 'Element',
        'config'     => [
            'type'             => 'inline',
            'foreign_table'    => 'tt_content',
            'foreign_field'    => 'parent_id',
        ],
    ],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_content', $additionalFields);

$GLOBALS['TCA']['tt_content']['types']['content_element']['showitem'] .= '
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
item
--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,
';    

error-message.jpg View (22 KB) Tobi Kretschmann, 2017-08-03 15:16

reproduce_82032.zip - Extension to help reproduce the issue. Readme inside. (2.71 KB) DANIEL Rémy, 2018-02-14 17:27


Related issues

Related to TYPO3 Core - Bug #87351: Delete content elements containing tt_content irre elements causes error Under Review 2019-01-07

Associated revisions

Revision eb042540 (diff)
Added by Christoph Lehmann 3 months ago

[TASK] Do not show error when copying a record was succesful

https://review.typo3.org/#/c/32356/ introduced the log message

The change was about skipping the direct copyRecord() call for
records that will be processed inside another copyRecord() call
for the record of the default language

Due to https://review.typo3.org/#/c/51070/ $overrideValues contains

['l10n_source' => 0]

When an element is copied inside an earlier copyRecord() call
the error log message is generated which leads to an error
flash message editors see when copying a page, but everything
(copying the records once) went fine.

A earlier call of copyRecord() can occur when using extension like
gridelements when copying a content element laying inside a
grid container element.

Resolves: #82032
Releases: master, 9.5, 8.7
Change-Id: I0d5be8e8920852a0e0c5a5ee93a67f9a6426e941
Reviewed-on: https://review.typo3.org/59202
Reviewed-by: Marcel Tams <>
Tested-by: Marcel Tams <>
Tested-by: TYPO3com <>
Reviewed-by: Christian Lange <>
Tested-by: Christian Lange <>
Reviewed-by: DANIEL Rémy <>
Reviewed-by: Mathias Brodala <>
Tested-by: Mathias Brodala <>

Revision b70a3d4c (diff)
Added by Christoph Lehmann 3 months ago

[TASK] Do not show error when copying a record was successful

https://review.typo3.org/#/c/32356/ introduced the log message

The change was about skipping the direct copyRecord() call for
records that will be processed inside another copyRecord() call
for the record of the default language

Due to https://review.typo3.org/#/c/51070/ $overrideValues contains

['l10n_source' => 0]

When an element is copied inside an earlier copyRecord() call
the error log message is generated which leads to an error
flash message editors see when copying a page, but everything
(copying the records once) went fine.

A earlier call of copyRecord() can occur when using extension like
gridelements when copying a content element laying inside a
grid container element.

Resolves: #82032
Releases: master, 9.5, 8.7
Change-Id: I0d5be8e8920852a0e0c5a5ee93a67f9a6426e941
Reviewed-on: https://review.typo3.org/59234
Tested-by: TYPO3com <>
Reviewed-by: Mathias Brodala <>
Tested-by: Mathias Brodala <>

Revision 148b0ee0 (diff)
Added by Christoph Lehmann 3 months ago

[TASK] Do not show error when copying a record was successful

https://review.typo3.org/#/c/32356/ introduced the log message

The change was about skipping the direct copyRecord() call for
records that will be processed inside another copyRecord() call
for the record of the default language

Due to https://review.typo3.org/#/c/51070/ $overrideValues contains

['l10n_source' => 0]

When an element is copied inside an earlier copyRecord() call
the error log message is generated which leads to an error
flash message editors see when copying a page, but everything
(copying the records once) went fine.

A earlier call of copyRecord() can occur when using extension like
gridelements when copying a content element laying inside a
grid container element.

Resolves: #82032
Releases: master, 9.5, 8.7
Change-Id: I0d5be8e8920852a0e0c5a5ee93a67f9a6426e941
Reviewed-on: https://review.typo3.org/59235
Reviewed-by: Christoph Lehmann <>
Tested-by: Christoph Lehmann <>
Tested-by: TYPO3com <>
Reviewed-by: Mathias Brodala <>
Tested-by: Mathias Brodala <>

History

#1 Updated by Heiko Bihlmaier over 1 year ago

  • Tracker changed from Bug to Epic
  • Priority changed from Should have to Must have

Hello,

I have the same error, but I don't have an IRRE Content Element.

I get this error when I copy a normal page with normal and mask content elements.

This is very annoying, because my customer needs this feature.

#2 Updated by Heiko Bihlmaier over 1 year ago

  • Tracker changed from Epic to Bug
  • TYPO3 Version set to 8
  • Complexity set to nightmare

#3 Updated by Kevin Purrmann over 1 year ago

Pointed out that tt_content field 'l10n_source' causes the problem.

In Datahandler on line 3363:

        if ($this->isRecordCopied($table, $uid)) {
            if (!empty($overrideValues)) {
                $this->log($table, $uid, 1, 0, 1, 'Repeated attempt to copy record "%s:%s" with override values', -1, [$table, $uid]);
            }
            return null;
        }

$overrideValues is l10n_source => 0. Set in line 3624 and called in 3634.

May it helps.

#4 Updated by Heiko Bihlmaier over 1 year ago

Can we fix this as soon as possible?

#5 Updated by Heiko Bihlmaier over 1 year ago

I make a temporary bugfix directly into the datahandler.

unset($overrideValues['l10n_source'])

Then the copy process works.

#6 Updated by ondro no-lastname-given over 1 year ago

Tobi Kretschmann wrote:

If the content element has an inline relation to tt_content (PID is the same) and the parent page is copied and pasted, the following error message will be displayed.

'1: Repeated attempt to copy record "tt_content:17671" with override values' (see screenshot)

The TCA for tt_content used to reproduce it, is:

[...]

Can confirm same behaviour with typo3 8.7.4

#7 Updated by Christoph Lehmann over 1 year ago

Confirmed in 8.7.6

#8 Updated by Tymoteusz Motylewski over 1 year ago

  • Category set to Localization

Thanks for the info.
Can you provide a small test extension to be able to quickly reproduce it?

#9 Updated by Heiko Bihlmaier over 1 year ago

You only need a page with content to reproduce this error.

When you wish, I can make a test system, where you can login in to test.

#10 Updated by Christoph Lehmann over 1 year ago

@Heiko: Do you have problems with deleting pages too ("Attempt to delete pages without delete-permission")? The will be deleted, but the message occurs. That was reported by an editor...

#11 Updated by Christoph Lehmann over 1 year ago

Error message on copying

I digged a little bit more into it and for me it's maybe an issue with gridelements:

  1. Add a page
  2. Add a gridlements ce
  3. Add an element into the grid element
  4. copy the page

Heiko, do you use gridelements too and is this our issue?

#12 Updated by Heiko Bihlmaier over 1 year ago

@Christoph

Our customer uses gridelements to build the site. Is that the reason for the copy error ?
Within the deletion process no error occurred.

#13 Updated by David Bender over 1 year ago

Heiko Bihlmaier wrote:

Our customer uses gridelements to build the site. Is that the reason for the copy error ?
Within the deletion process no error occurred.

I can confirm this behaviour with copying pages containing gridelements, too. For admin users as well as for editors.

Do you have problems with deleting pages too ("Attempt to delete pages without delete-permission")? The will be deleted, but the message > occurs. That was reported by an editor...

I can confirm this behaviour as well, but only for editors (and containing gridelements). Within my admin user no error occured, as described above.

#14 Updated by Felix Nagel over 1 year ago

Same issue here, TYPO3 8.7.6.

This seems to be an issue caused by copying IRRE elements (e.g. gridelements, flux sections, ...) in the page module.

#15 Updated by Gernot Ploiner over 1 year ago

Same error occurs with Mask and nested content (this is based on IRRE).

#16 Updated by Laurent Foulloy over 1 year ago

I confirm the error in TYPO3 8.7.8 when using one gridelement ce which contains one element.

As far as I can understand from the code, the method copySpecificPage() loops on all contents in the page, i.e. the gridelement ce and its child.
When processing the gridelement ce, the method copyRecord() is called. =This method calls the method copyRecord_processInline() which itself calls the method copyRecord_raw() for each child. This leads to have the child marked as copied.
After having processed the gridelement ce, its child is processed again by copyRecord()in the loop in copySpecificPage() which leads to the error.

Could one solution be to skip the call to copyRecord()when the record is already marked as copied ?

For example changing the following condition in copySpecificPage() solves the problem but I am not sure if there are side effects.

if ($row[$languageField] > 0 && $transOrigPointer > 0 && isset($rows[$transOrigPointer])) {
    continue;
}

to

if (($row[$languageField] > 0 && $transOrigPointer > 0 && isset($rows[$transOrigPointer])) || $this->isRecordCopied($table, $row['uid'])) {
    continue;
}

#17 Updated by Stefan P about 1 year ago

What is the state of this bug? We are experiencing this as well, but with our own private implmentation of grid-like content elements (where a CE is an inline child of another CE), we do not have any other extension that alters tt_content.

#18 Updated by Stephan Brun about 1 year ago

I still can reproduce the behaviour with TYPO3 8.7.9 and Gridelements 8.0.0
But only as an editor, not as admin.

I have also the error message "Attempt to delete pages without delete-permission" on deleting pages, which Christoph mentioned.

#19 Updated by DANIEL Rémy about 1 year ago

Hello

Some further information on the cause of this issue...

This issue was introduced by change "[FEATURE] Introduce l10n_source field for tt_content", changeId: I3ecfeedb656c64681e5e3021cad6b708482520dc, review: https://review.typo3.org/51070

With this change, a copied record now have its l10n_source reset to 0.

But, this conflict with a preceding change which prevent an embedded record to be copied twice.
This is the purpose of the error message "Repeated attempt to copy record...": to prevent to copy a record that will be processed inside another copyRecord() call for the record of the default language. See commit message of changeId: I6647b02095343756d3a41b0c0e985b4777429cd8 reviewed on http://review.typo3.org/32356

So... what to do now?

I hope specialists of localization and workspace handling in the dataHandler will read that ;-)

#20 Updated by DANIEL Rémy about 1 year ago

I've attached a simple extension to help reproduce the issue.

#21 Updated by Tymoteusz Motylewski about 1 year ago

The easiest way to reproduce it is to:
- install EXT:Styleguide (it's included in the core require-dev depenedencies)
- go to styleguide module (help icon from top toolbar)
- navigate to "TCA / Records" tab
- click "Create styleguide page tree with data"
- go to page module
- try to copy "inline 1n"page
- Errors will appear:

1: Repeated attempt to copy record "tx_styleguide_inline_1n_child:15" with override values
1: Repeated attempt to copy record "tx_styleguide_inline_1n_child:14" with override values    
1: Repeated attempt to copy record "tx_styleguide_inline_1n_child:18" with override values

The next step would be to create a functional test case illustrating the issue.
I think a test typo3/sysext/core/Tests/Functional/DataHandling/IRRE/ForeignField/Modify/ActionTest.php
dataset could be extended to make copyPage test fail.

#22 Updated by Rick Feuerabend about 1 year ago

Can also confirm this bug with TYPO3 v8.7.8 and mask v3.0.3. Mainly the copying of inline elements is working and just the log message is shown. But sometimes it happens that the inline elements are duplicated.

#23 Updated by Karsten B B about 1 year ago

The same for me. "1: Repeated attempt to copy record "tt_content:1589" with override values" in TYPO3 8.7.11.

#24 Updated by Lorenz Ulrich about 1 year ago

Same problem here with EXT:gridelements.

#25 Updated by Jo Hasenau about 1 year ago

  • Status changed from New to Accepted
  • Complexity changed from nightmare to medium

#26 Updated by Webadmin no-lastname-given 11 months ago

Still happens in Typo3 8.7.13 with gridelements installed...

#27 Updated by Sebastian Schmal 11 months ago

Webadmin no-lastname-given wrote:

Still happens in Typo3 8.7.13 with gridelements installed...

same here! PLZ fix after 9 Months! Thanks!

#28 Updated by Wolfgang Wagner 8 months ago

Bug still present in 8.7.18

#29 Updated by Michael Grundkötter 7 months ago

Still present in TYPO3 8.7.19 with gridelements 8.2.3

#30 Updated by Tom Arnold 7 months ago

Still present in 8.7.19 with custom nested elements (via Mask_Export). Despite the error showing in the backend (as an admin user, too) the elements then are copied correctly. I think this has changed since I first stumbled across this issue in the same install some months ago, where elements were missing in the copied page.

#31 Updated by Stefan P 5 months ago

  • Category changed from Localization to DataHandler aka TCEmain

We have this also in a project with Gridlements, TYPO3 8.7.19.

I changed the category from Localisation to DataHandler because this is not restricted to localisation, it also affects single-language copies.

#32 Updated by Bernhard Berger 4 months ago

still present in 8.7.20 :/ Hard to sell TYPO3 on new customers when they get massive error messages while basic work with the CMS :/

#33 Updated by Gerrit Code Review 3 months ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59202

#34 Updated by Gerrit Code Review 3 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59202

#35 Updated by Gerrit Code Review 3 months ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59234

#36 Updated by Gerrit Code Review 3 months ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59235

#37 Updated by Christoph Lehmann 3 months ago

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

#38 Updated by Gerfried no-lastname-given 3 months ago

Really? The fix was to remove the message?

#39 Updated by Gerrit Code Review 3 months ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59281

#40 Updated by Gerrit Code Review 3 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59281

#41 Updated by Gerrit Code Review 3 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59281

#42 Updated by Mathias Brodala 2 months ago

  • Status changed from Under Review to Resolved

More changes will be done in separate tickets.

#43 Updated by Mathias Brodala 2 months ago

  • Related to Bug #87351: Delete content elements containing tt_content irre elements causes error added

Also available in: Atom PDF