Review main Merged

79462[BUGFIX] Avoid fatal error with invalid soft reference parser links

Torben Hansen CR +2 V +2 Normal +49 −21 updated 07/03/23, 20:11

Commit message

When a link href is empty or invalid, TYPO3 now does not
crash anymore.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oliver Klee +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oliver Klee +1

Issues 1

Files 7

Review log 2736

Show 911 earlier messages
  1. Torben Hansen uploaded patch set 1 06/20/23, 11:48

  2. core-ci voted on patch set 1 V +1 06/20/23, 11:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42831

  3. Benni Mack commented on patch set 1 06/20/23, 12:32

    LegacyLinkNotationConverter.php:89

    should be TYPE_UNKNOWN
  4. Torben Hansen commented on patch set 1 06/20/23, 13:57

    LegacyLinkNotationConverter.php:89 Reply

    Agree, but there seems to be something wrong with the handling of TYPE_UNKNOWN links in LinkElement See https://github.com/TYPO3/typo3/blob/main/typo3/sysext/backend/Classes/Form/Element/LinkElement.php#L421 It expects `$linkData['file']`, which is/should not available for unknown type. Unsure how to proceed here.
  5. Benni Mack commented on patch set 1 06/20/23, 15:06

    LegacyLinkNotationConverter.php:89 Reply

    type unknown was introduced when people still had something like this in their links in RTEs: href="/fileadmin/my-pic.jpg" where we did or could not resolve to a file. That's why there is "file" (also in 1-2 other places), I guess we could change the unknown from "file" to "destination" or something like that?
  6. Torben Hansen rebased onto patch set 2 V +1 06/27/23, 13:32

  7. core-ci voted on patch set 2 V +1 06/27/23, 13:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43033

  8. Torben Hansen commented on patch set 2 06/27/23, 14:12

    LegacyLinkNotationConverter.php:89 Reply

    I tried to change this to `LinkService::TYPE_UNKNOWN`, but then `LegacyLinkBuilder` crashes in frontend, because it can not proceed with the resolved unknown link type. Also `LinkService::TYPE_UNKNOWN` actually is a "known" type, so the form control displays the content as is and does not indicate to the user, that the whole link is wrong. `LinkService::TYPE_UNKNOWN` seems to be OK for links starting with a slash (e.g. old fileadmin-links), but for this special case, I think it is valid to return no type, so the `not implemented type` message is shown and the link is not processed by `LegacyLinkBuilder`.
  9. Benni Mack commented on patch set 2 07/03/23, 11:03

    LegacyLinkNotationConverter.php:89 Reply

    maybe we can steal the relevant parts from this change: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78604
  10. Benni Mack uploaded patch set 3 V +1 07/03/23, 17:25

  11. Benni Mack commented on patch set 3 07/03/23, 17:25

    LegacyLinkNotationConverter.php:89 Reply

    Done
  1. Benni Mack uploaded patch set 4 07/03/23, 17:30

  2. core-ci voted on patch set 3 V +1 07/03/23, 17:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43273

  3. core-ci voted on patch set 4 V +1 07/03/23, 17:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43274

  4. Benni Mack voted on patch set 4 V +1 CR +1 07/03/23, 17:47

  5. Benni Mack uploaded patch set 5 CR +1 V +1 07/03/23, 18:01

  6. Benni Mack updated the commit message in patch set 6 07/03/23, 18:01

  7. core-ci voted on patch set 6 V +1 07/03/23, 18:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43278

  8. core-ci voted on patch set 5 V +1 07/03/23, 18:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43277

  9. Benni Mack uploaded patch set 7 V +1 07/03/23, 18:20

  10. core-ci voted on patch set 7 V -1 07/03/23, 18:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43279

  11. Benni Mack uploaded patch set 8 V -1 07/03/23, 18:40

  12. core-ci voted on patch set 8 V +1 07/03/23, 18:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43280

  13. Torben Hansen uploaded patch set 9 V +1 07/03/23, 19:01

  14. core-ci voted on patch set 9 V +1 07/03/23, 19:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43283

  15. Jochen Roth voted on patch set 9 V +1 CR +1 07/03/23, 19:28

  16. Oliver Klee voted on patch set 9 V +1 07/03/23, 19:36

  17. Oliver Klee commented on patch set 9 CR -1 07/03/23, 19:37

    We also need to adapt to type annotations to match our changes (as they otherwise would not be correct).

    LinkElement.php:376

    File|null

    LinkElement.php:386

    Folder|null
  18. Benni Mack commented on patch set 9 07/03/23, 19:54

    Reply

    can't we remove them if we have the instanceof checks?
  19. Oliver Klee commented on patch set 9 07/03/23, 20:03

    Reply

    Good catch - we can indeed!
  20. Benni Mack commented on patch set 10 CR +1 V +1 07/03/23, 20:03

    Published edit on patch set 9.
  21. Benni Mack commented on patch set 10 07/03/23, 20:03

    Reply

    Done

    LinkElement.php:376 Reply

    Done

    LinkElement.php:386 Reply

    Done
  22. Benni Mack voted on patch set 10 V +1 CR +1 07/03/23, 20:03

  23. Oliver Klee voted on patch set 10 V +1 CR +1 07/03/23, 20:10

  24. Benni Mack voted on patch set 10 V +2 CR +2 07/03/23, 20:11

  25. Benni Mack merged patch set 11 07/03/23, 20:11