FluidTYPO3 / flux

TYPO3 extension Flux: Dynamic Fluid FlexForms
https://fluidtypo3.org
146 stars 212 forks source link

BUG: Problem with fal relations on inserting pages from the clipboard (make copy of a page) #2146

Closed steampixel closed 2 months ago

steampixel commented 9 months ago

Typo3 12.4.7 Current dev branch of flux from October 10th Edit: Confirmed the bug with today's dev version of flux (15th December)

Create a new page template and insert the following file relation field:

  1. <flux:field.inline.fal name="image" required="false" label="Bild" collapseAll="true"></flux:field.inline.fal>
  2. Create a new page in typo that uses the template
  3. Select an image by editing the page configuration
  4. Save the page
  5. A new entry should appear in sys_file_reference. The pid and the uid_foreign should both point to the page uid
  6. Copy the page to the clipboard using the context menu inside the backend page tree
  7. Use the context menu again to insert a copy of the page somewhere

Expected behavior: The new page should have the file reference attached to it

Observed behavior: The image field of the new page is empty. The original source page has now two image references. The table sys_file_reference now holds two records with uid_foreign pointing to the source page.

This problem affects only file references created with flux:field.inline.fal inside pages. Content elements are not affected. Also TCA fields are not affected by this bug.

How to clean up the database quickly after this crash (Remove all broken file references on pages, normally pid and uid_foreign are equal):

DELETE FROM sys_file_reference WHERE tablenames = 'pages' AND uid_foreign != pid

steampixel commented 9 months ago

Confirmed the bug with today's dev version of flux (15th December)

NamelessCoder commented 2 months ago

That was an excessively nasty bug caused by TYPO3 doing some strange things specifically when copying pages, when the FlexForm DS implementation depends on exactly the one value that is not part of the input record passed to the DS resolving logic. It took me over 6 hours of debugging to figure this out so I really hope you appreciate the fix!

steampixel commented 2 months ago

Thank you so much! Typo3 is sometimes a nightmare. Now things have gotten a little better :-) Thank you! I'll check that out when I get a chance...