Bug #67188

Epic #72584: sysext:impexp

Wrong FAL References after Import

Added by Robert Heinig over 4 years ago. Updated 12 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Import/Export (T3D)
Target version:
-
Start date:
2015-05-29
Due date:
% Done:

100%

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

Description

Scenario:
Export source systen:
Two sys_file entries were exported with uids 1 and 2. They both have sys_file_reference entries.
Import target system:
There is already one sys_file entry with uid 1.

After Import all sys_file_reference references formerly referenced to sys_file:1 will be referenced to sys_file:3, but they should be refrenced to sys_file:2.

This behavior is caused by TYPO3\CMS\Impexp\ImportExport::fixUidLocalInSysFileReferenceRecords(). During import this function will correctly replace sys_file:1 references with sys_file:2. But when it looks for sys_file:2 to replace, it will not only replace "old" sys_file:2 occurrences, it replaces all sys_file:2 occurrences, which is wrong, because the there are old and new sys_file:2 present in the records array.

Solution:
I fixed this issue with setting a "processed" flag within fixUidLocalInSysFileReferenceRecords() as sibling of the "data" array when replacing the uid_local value of a sys_file_reference entry. Besides checking for file uid equality the if condition checks whether the "processed" flag was set.

There may be a better solution for this problem, i donĀ“t know the impexp extension very well.


Related issues

Related to TYPO3 Core - Bug #84041: Existing file references are modified after export/import Accepted 2018-02-26
Duplicated by TYPO3 Core - Bug #72207: Files missing in import/export Closed 2015-12-14

Associated revisions

Revision cd7a8572 (diff)
Added by Christian Kuhn over 1 year ago

[BUGFIX] impexp: Wrong FAL references after import

Fix a case during ext:impexp FAL uid mapping where
sys_file_reference end up pointing to wrong sys_file
records in case new sys_file uids also already exist
in import file, due to multiple mappings.
Power the patch with a functional test - it fails
without the change in Import.php and is ok with the
change.
See the test method comments for more details
on what exactly is checked here.

Change-Id: I472cad2652e8d6f5d30e4ebc68ff1ae93de71ea1
Resolves: #67188
Releases: master, 8.7, 7.6
Reviewed-on: https://review.typo3.org/55365
Tested-by: TYPO3com <>
Reviewed-by: Benjamin Kott <>
Tested-by: Benjamin Kott <>
Reviewed-by: Frank Naegler <>
Tested-by: Frank Naegler <>
Reviewed-by: Wouter Wolters <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

Revision 7585a53d (diff)
Added by Christian Kuhn over 1 year ago

[BUGFIX] impexp: Wrong FAL references after import

Fix a case during ext:impexp FAL uid mapping where
sys_file_reference end up pointing to wrong sys_file
records in case new sys_file uids also already exist
in import file, due to multiple mappings.
Power the patch with a functional test - it fails
without the change in Import.php and is ok with the
change.
See the test method comments for more details
on what exactly is checked here.

Change-Id: I472cad2652e8d6f5d30e4ebc68ff1ae93de71ea1
Resolves: #67188
Releases: master, 8.7, 7.6
Reviewed-on: https://review.typo3.org/55367
Tested-by: TYPO3com <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

Revision 587e83cc (diff)
Added by Christian Kuhn over 1 year ago

[BUGFIX] impexp: Wrong FAL references after import

Fix a case during ext:impexp FAL uid mapping where
sys_file_reference end up pointing to wrong sys_file
records in case new sys_file uids also already exist
in import file, due to multiple mappings.
Power the patch with a functional test - it fails
without the change in Import.php and is ok with the
change.
See the test method comments for more details
on what exactly is checked here.

Change-Id: I472cad2652e8d6f5d30e4ebc68ff1ae93de71ea1
Resolves: #67188
Releases: master, 8.7, 7.6
Reviewed-on: https://review.typo3.org/55368
Tested-by: TYPO3com <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

History

#1 Updated by Marc Bastian Heinrichs about 4 years ago

  • Status changed from New to Accepted
  • Assignee set to Marc Bastian Heinrichs
  • Priority changed from Must have to Should have

#2 Updated by Mathias Schreiber almost 4 years ago

  • Target version deleted (next-patchlevel)

#3 Updated by Anja Leichsenring over 3 years ago

  • Parent task set to #72584

#4 Updated by Anja Leichsenring over 3 years ago

  • Sprint Focus set to On Location Sprint

#5 Updated by Markus Klein over 3 years ago

  • Assignee deleted (Marc Bastian Heinrichs)

#6 Updated by Nicole Cordes over 3 years ago

  • Sprint Focus deleted (On Location Sprint)

#7 Updated by Christian Kuhn over 1 year ago

  • Duplicated by Bug #72207: Files missing in import/export added

#8 Updated by Gerrit Code Review over 1 year 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/55365

#9 Updated by Christian Kuhn over 1 year ago

Confirmed.

This one is nasty. It seems this issue currently also triggers some 'missing / wrong' images if installing ext:introduction distribution.

Special thanks for the explanation and analysis Robert, that helped a lot already.

It took me a while, but I was able to reproduce this locally with your description, then came up with a functional test case to reproduce that in code.

Now lets see if we can fix this issue.

#10 Updated by Gerrit Code Review over 1 year 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/55365

#11 Updated by Gerrit Code Review over 1 year 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/55365

#12 Updated by Gerrit Code Review over 1 year ago

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

#13 Updated by Gerrit Code Review over 1 year ago

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

#14 Updated by Gerrit Code Review over 1 year 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/55367

#15 Updated by Gerrit Code Review over 1 year ago

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

#16 Updated by Christian Kuhn over 1 year ago

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

#17 Updated by Marc Bastian Heinrichs over 1 year ago

Kudos Lolli, thx for the hard brain work!

#18 Updated by Markus Klein over 1 year ago

  • Related to Bug #84041: Existing file references are modified after export/import added

#19 Updated by Benni Mack 12 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF