86875[BUGFIX] Handle links to CE correctly in Linkvalidator
Commit message
Review
-
Code review CR 0
-
Verified V 0
Issues 1
Files 4
- typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php11+44 −9
- typo3/sysext/linkvalidator/Tests/Functional/Fixtures/expected_link_with_page_ce.csvnew+6 −0
- typo3/sysext/linkvalidator/Tests/Functional/Fixtures/input_link_with_page_ce.csvnew+18 −0
- typo3/sysext/linkvalidator/Tests/Functional/LinkAnalyzerTest.php+7 −0
Review log 1723
-
Sybille Peters uploaded patch set 1 11/03/24, 13:42
-
Sybille Peters uploaded patch set 2 11/03/24, 13:43
-
core-ci voted on patch set 1 V -1 11/03/24, 13:50 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68997
-
core-ci voted on patch set 2 V -1 11/03/24, 13:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68998
-
Sybille Peters uploaded patch set 3
V -111/03/24, 14:07 -
Sybille Peters uploaded patch set 4 11/03/24, 14:09
-
core-ci voted on patch set 3 V +1 11/03/24, 14:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68999
-
core-ci voted on patch set 4 V +1 11/03/24, 14:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69000
-
Simon Schaufelberger voted on patch set 4 CR +1 V +1 11/04/24, 11:15
-
Garvin Hicking commented on patch set 4 11/04/24, 13:19
LinkAnalyzer.php:439This $type looks a bit problematic. $type is set to '' at the beginning. In the earlier code, $type was iterated in the context of $element of getMatchedElements(), resetting $type always to '' after each iteration. In the new code, $type would always stay to be set to the last type of the previous iteration. Probably using `$linkType->fetchType($reference, '', $keyArr)` would be more logical to always force getting the right type from the current linktypeRegistry? (untested)LinkAnalyzer.php:451I think at this point `$foundLink['pageAndAnchor']` will always be set, so we wouldn't need the ?? fallback, increasing for clarity (like the other assignments).input_header_link_with_page_ce_to_hidden.csv:8I would suggest to create a fixture that uses a distinct page uid and content element uid (instead of using both as "1") because then in a test you can't be certain if by accident the page uid or tt_content uid is used twice. (If there is a chance to have this "x#y" notation also in non-tt_content examples, maybe this could be added, too?) -
Sybille Peters commented on patch set 4 11/04/24, 13:40
LinkAnalyzer.php:425ReplyI don't know about the internal link handling. I looked in the function analyzeTypolinks and tried to apply similar handling here. Apart from that, I find the function analyzeTypolinks very weird. Perhaps the 2 functions can be refactored and merged. But I really don't know if that should be the scope of this bugfix. I would rather keep this a simple bugfix. For now, the focus is on fixing the bug and backporting it. If we really want to change a lot, perhaps we should look into if the 2 functions analylizeTypolinks and analyizeLinks can be merged or if core functionality can be reused. I am a bit puzzled - should this kind of functionality be also required in other places in the core? 2. This is the same as in analyzeTypolinks You may be right. 3. Variable naming: Should we rename all the variables just for a simple bug fix.LinkAnalyzer.php:439ReplyYou are probably right.LinkAnalyzer.php:451Replyokinput_header_link_with_page_ce_to_hidden.csv:8Replygood idea -
Garvin Hicking commented on patch set 4 11/04/24, 14:20
LinkAnalyzer.php:425ReplyI fully agree, merging or refactoring both methods sounds out of scope to me. As for variables I mostly referred to ones that are added new with this patch, so it would be fair to give those proper names (currentR, 'substr'). -
Sybille Peters uploaded patch set 5
CR +1V +111/05/24, 07:08 -
Sybille Peters commented on patch set 4 11/05/24, 07:10
input_header_link_with_page_ce_to_hidden.csv:8ReplyI changed the ids so the uids and pids are all unique. I added some more links in the fixture so we test all of: - hidden ce on hidden page - not hidden ce on hidden page - hidden ce on not hidden page - not hidden ce on not hidden page Also, I added link for sys_file_reference.link Working on rest of the suggestions .... -
core-ci voted on patch set 5 V +1 11/05/24, 07:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69076
-
Sybille Peters uploaded patch set 6
V +111/05/24, 08:11 -
Sybille Peters commented on patch set 6 11/05/24, 08:13
LinkAnalyzer.php:425ReplyI changed the variable naming (point 3). About point 1 and 2 don't really know how to handle them right now.LinkAnalyzer.php:439ReplyDoneLinkAnalyzer.php:451ReplyDone -
core-ci voted on patch set 6 V +1 11/05/24, 08:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69081
-
Sybille Peters wrote 11/07/24, 12:58
Topic set to Linkvalidator -
Sybille Peters abandoned the change 11/16/24, 16:00
will use different approach (see last comment), created new patch: https://review.typo3.org/c/Packages/TYPO3.CMS/+/87004 -
Sybille Peters commented on patch set 6 11/16/24, 16:00
LinkAnalyzer.php:425Reply UnresolvedI don't see a possibility to find out which of the 2 references the softref parser has split up belong together. In the bug we are trying to solve however, we have fields that do not really need parsing, they contain only the link (with 'type' = 'link' in TCA). So instead of using the softref parsers for type='link' I think we can construct the link record directly from the content. This is an entirely different approach, so I uploaded a new patch and will abandon this one. https://review.typo3.org/c/Packages/TYPO3.CMS/+/87004 -
Sybille Peters restored the change 11/16/24, 16:00
-
Sybille Peters abandoned the change 11/16/24, 16:01
Use different approach (see last comment), new patch: https://review.typo3.org/c/Packages/TYPO3.CMS/+/87004
LinkAnalyzer.php:425