Bug #84080
closedXML export breaks if RTE field contains link to a file
100%
Description
Exporting a page with tt_content holding a link to a file crashes the export with
#1476107295: PHP Warning: strlen() expects parameter 1 to be string, object given in typo3/sysext/core/Classes/Utility/GeneralUtility.php line 1754
This is the GeneralUtility:array2xml export function.
The reason for this warning is that the array passed to the xml converter function includes objects.
To be precise a FAL File object.
It turns out that the subarray holding this object actually stems from the processing chain Export -> ReferenceIndex -> SoftReferenceIndex -> LinkService -> FileLinkHandler
This file object is part of the SoftReference data structure due to the change done with #80991 (1522bad3362b0e68d404b09cc1eadae45970ddcc), which added the result of the LinkHandler to the SoftReference structure.
In the case of FileLinkHandler this includes the File object of the referenced file.
Exporting such a thing as t3d works, as the object (incl. its nested Storage object) is simply serialized.
But exporting this as XML fails, due to array2xml being unable to cope with objects.
Having this information included causes multiple issues:
- It introduces a strong coupling of the LinkHandler results with the SoftReference data structure
- It may cause side effects if a LinkHandler is changed, as the SoftReference data structure is implicitly modified
- It violates the "interface" to the SoftReferenceIndex class, which precisely describes, what it delivers.
The solution to this issue is that it is not necessary to include the whole information from the LinkHandler into the SoftReference data structure, as no component is using it.