Analysis¶
The reported bug here will be solved by reverting the first hunk in
https://review.typo3.org/#/c/37086/2/typo3/sysext/core/Classes/Database/ReferenceIndex.php
After reverting this code, the situation in the ReferenceIndex code is that there is code that parses fields
- if a link wizard is attached
- if a softref parser is defined
For the header_link field currently both options apply, which causes the field to be parsed twice.
There are some other (old) fields in the compatibility6 sysext, which have the same TCA setting as header_link, but pass an additional option to the typolink-softref-parser, named linkList (that is support for multiple links in a single field).
The wizard link FAL handling was introduced with https://review.typo3.org/#/c/10655/2/t3lib/class.t3lib_refindex.php (2012-04-20)
The softref FAL handling was introduced with https://review.typo3.org/#/c/10942/7/typo3/sysext/core/Classes/Database/SoftReferenceIndex.php (2013-03-22)
So the second change actually caused this duplicate indexing, as the softref-definition of the header_link fields is there since the initial commit!
Possible solutions¶
A possible solution would be to drop the softref-configuration on the header_link field, but that keeps the problem for the old fields, which need special treatment (linkList) through the softref-parser. So this is not a clean solution.
Another option would be to add a condition to the first code part and only run the parser if a link wizard is present but no softref-parser. (This will probably work, but is not nice code-wise as we couple two different classes via their configuration.)
Dropping the parsing for link wizards completely would be the best solution, leaving the magic to the softref-parser, since those fields are actually soft-refs and no real db-refs.
IMHO the original patch introducing this is just plain wrong about that code.