Bug #56284

Copied references keep reference to original

Added by Philipp Wrann over 5 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
Start date:
2014-02-25
Due date:
% Done:

0%

TYPO3 Version:
6.2
PHP Version:
5.3
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

When copying a record which holds sys_file_reference records the reference is copied with wrong relation data, so the original has 2 references but the copy none.


Related issues

Related to TYPO3 Core - Bug #44795: Page tree - Copy page (and paste) - preview images (often missing) Closed 2013-01-25

History

#1 Updated by Thomas Hempel over 5 years ago

We can reproduce this behavior and it's still valid for 6.2beta6

As far as I can see, the relation to the sys_file_reference simply has the wrong uid_foreign after copy.

#2 Updated by Thomas Hempel over 5 years ago

Alright, we tracked it down, and this is a serious issue as far as I can tell.

This is what we think right now:

When you copy a page, the core duplicates all records in order of their respective table in the TCA. The problem with this is, that tt_content is defined in "frontend" and sys_file_references are defined in the extension "core". By default core is loaded first, which means that tt_content records are copied AFTER all records defined in "frontend". The result is, that sys_file_references get copied but the relation can not be updated because the new tt_content record does not exist yet.

The problem can be solved by moving "frontend" before "core" in the packageStates.php. This is of course not a real solution but demonstrates the effect.

We could also observe another strange behavior. When you copy the original page again and paste it again, it will all file references but one. So if you start with

Page1 - tt_content:File1

-- first copy --

Page 1 - tt_content:File1, File1 (copy 1)
Page 1 (copy 1) - tt_content:

-- second copy of Page 1 --

Page 1 - tt_content:File1, File1 (copy 1), File1 (copy 2)
Page 1 (copy 1) - tt_content:
Page 1 (copy 2) - tt_content:File1

-- n copy of Page 1 --

Page 1 - tt_content:File1, File1 (copy 1), File1 (copy 2), File (copy 1), File (copy 2)
Page 1 (copy 1) - tt_content:
Page 1 (copy 2) - tt_content:File1
Page 1 (copy n) - tt_content:File1, File (copy 1), File (copy n)

This can be done indefinitely.

This is a major design flaw in the copy routine as it practically prevents related records to be copied with a page if they are not defined in ext:core.

Another small remark. This only occurs when copying the page. If you copy only the tt_content element, everything works fine.

#3 Updated by Patrick Kollodzik over 5 years ago

The position of the $table inside the TCA is importent in the following code position:

In \TYPO3\CMS\Core\DataHandling\DataHandler, method copySpecificPage

The method iterates over all possible tables and tests if a record is on the page.
Because EXT:core is loaded before EXT:frontend the sys_file_refernce are copied before tt_content.

#4 Updated by Nicole Cordes over 5 years ago

  • Assignee set to Nicole Cordes

#5 Updated by Nicole Cordes over 5 years ago

  • Status changed from New to Accepted

#6 Updated by Martin Ficzel over 5 years ago

What can we do to help fixing this issue. It is really a huge problem for us since editors cannot copy pages with images at all at the moment.

Regards Martin

#7 Updated by Alexander Stehlik over 5 years ago

Is this problem fixed with https://review.typo3.org/26552/ ?

#8 Updated by Martin Ficzel over 5 years ago

Yes it seems https://review.typo3.org/26552/ fixes this aswell.

#9 Updated by Ernesto Baschny over 5 years ago

  • Status changed from Accepted to Needs Feedback
  • Target version deleted (next-patchlevel)

If this is fixed by the just merged #44795, we have this problem solved for 6.2.0 - great! :)

Confirmed? We could then close this issue.

#10 Updated by Daniel Ostmann over 5 years ago

I can confirm this issue for 6.2.beta7.

The patch in https://review.typo3.org/#/c/26552/ solved it! Thank you :-)

#11 Updated by Martin Ficzel over 5 years ago

For me this is solved after #44795. I cannot reproduce the Problem any more.

#12 Updated by Ernesto Baschny over 5 years ago

  • Status changed from Needs Feedback to Resolved
  • Assignee deleted (Nicole Cordes)
  • Target version set to 6.2.0

Great stuff, solved finally :)

#13 Updated by Frank Gerards over 4 years ago

Any updates on this ? Is this fixed in TYPO3 6.2.12 ???

#14 Updated by Frank Gerards over 4 years ago

is this solved now ?

#15 Updated by Daniel Ostmann over 4 years ago

Frank, please note the last update before yours. It is marked as solved :-)

#16 Updated by Riccardo De Contardi about 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF