Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.

Review main Ready for review Quiet

79154[BUGFIX] Handle typolinks with page?uid=current

Sybille Peters CR 0 V -1 Normal +195 −22 updated 10/02/26, 12:07

Commit message

Links with a typolink target URL to the current page
of the format t3://page?uid=current were not handled
correctly in some situations.

This was due to the fact that the soft reference
parsers handling typolinks did not correctly handle
the typolink page URL format with "uid=current". The
softref parsers always expected a numeric uid only.

This has now been fixed and several tests added for
the softref parsers and reference index.

To make the change non-breaking, a new commented out
additional parameter $row was introduced in
SoftReferenceParserInterface::parse().
This makes it possible to pass the $row, where the
page uid can be retrieved.

Custom softref parsers should still work, but they
should be updated to also pass $row in parse().

The known cases where the previous behaviour resulted
in a bug were in reference index and link validator.
This was only potentially problematic in linkvalidator,
as references to itself must not necessarily be
recorded in the reference index. However, the
behaviour was inconsistent, as links to the current
page resulted in refindex entries if the page uid
instead of "current" was used.

Previously, a reference index entry was not created
for page links using "current". This is now the case.

The number of entries in the reference index may now
increase.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 24
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/54/79154/24 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/54/79154/24 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V -1 Blocked
    • core-ci -1 CI

Issues 2

Files 16

Review log 4064

Show 2239 earlier messages
  1. Sybille Peters uploaded patch set 1 05/31/23, 09:57

  2. Sybille Peters uploaded patch set 2 05/31/23, 10:05

  3. core-ci voted on patch set 1 V -1 05/31/23, 10:10 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42107

  4. core-ci voted on patch set 2 V -1 05/31/23, 10:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42108

  5. Sybille Peters uploaded patch set 3 05/31/23, 10:24

    Copied Votes: * Verified-1 (copy condition: "changekind:NO_CHANGE")
  6. core-ci voted on patch set 3 V -1 05/31/23, 10:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42109

  7. Sybille Peters uploaded patch set 4 V -1 05/31/23, 11:13

  8. core-ci voted on patch set 4 V -1 05/31/23, 11:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42110

  9. Sybille Peters uploaded patch set 5 V -1 05/31/23, 12:27

  10. core-ci voted on patch set 5 V +1 05/31/23, 12:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42112

  11. Sybille Peters uploaded patch set 6 V +1 05/31/23, 13:32

  12. core-ci voted on patch set 6 V -1 05/31/23, 13:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42115

  13. Sybille Peters uploaded patch set 7 V -1 06/01/23, 07:44

  14. Sybille Peters commented on patch set 7 06/01/23, 07:46

    See discussion of various solutions for this in issue: https://forge.typo3.org/issues/100934#note-12
  15. core-ci voted on patch set 7 V -1 06/01/23, 07:55 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42133

  16. Sybille Peters uploaded patch set 8 V -1 06/01/23, 08:01

  17. Sybille Peters uploaded patch set 9 06/01/23, 08:05

  18. core-ci voted on patch set 8 V -1 06/01/23, 08:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42134

  19. core-ci voted on patch set 9 V -1 06/01/23, 08:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42135

  20. Sybille Peters uploaded patch set 10 V -1 06/01/23, 08:30

  21. core-ci voted on patch set 10 V -1 06/01/23, 09:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42136

  22. Sybille Peters uploaded patch set 11 V -1 06/01/23, 09:32

  23. core-ci voted on patch set 11 V -1 06/01/23, 09:44 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42141

  24. Sybille Peters uploaded patch set 12 V -1 06/01/23, 10:01

  25. core-ci voted on patch set 12 V -1 06/01/23, 10:12 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42143

  26. Sybille Peters uploaded patch set 13 V -1 06/01/23, 10:50

  27. core-ci voted on patch set 13 V -1 06/01/23, 11:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42147

  28. Sybille Peters uploaded patch set 14 V -1 06/01/23, 11:59

  29. core-ci voted on patch set 14 V +1 06/01/23, 12:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42153

  30. Sybille Peters uploaded patch set 15 V +1 06/01/23, 12:21

  31. core-ci voted on patch set 15 V +1 06/01/23, 12:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42154

  32. Sybille Peters updated the commit message in patch set 16 V +1 06/03/23, 08:42

  33. core-ci voted on patch set 16 V +1 06/03/23, 08:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42182

  34. Susi Moog commented on patch set 16 07/04/23, 14:34

    TypolinkSoftReferenceParser.php:46

    How does this behave for pages? is pid correct there or should this be uid?
  35. Oliver Klee commented on patch set 16 08/03/23, 19:43

    There is a merge conflict - we'll need a rebase for this.

    SoftReferenceParserInterface.php:46

    Can we remove the commented-out code and the corresponding `@param` annotation (which would remove the new PHPStan warning)? (We still can keep the `@todo` annotation and then add the PHPDoc annotation when we really add the array. Or we could create a ticket instead of having the commented-out code. What do you think?
  36. Jasmina Ließmann uploaded patch set 17 V +1 08/03/23, 21:39

  37. core-ci voted on patch set 17 V +1 08/03/23, 21:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44996

  38. Sybille Peters rebased onto patch set 18 V +1 08/12/23, 09:13

  39. Sybille Peters commented on patch set 18 08/12/23, 09:14

    Reply

    Done
  1. core-ci voted on patch set 18 V +1 08/12/23, 09:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45407

  2. Sybille Peters commented on patch set 18 08/12/23, 09:36

    SoftReferenceParserInterface.php:46 Reply

    Just removing the comment and @param annotation will not get rid of all phpstan warnings. What is current best practice for adding a new function parameter in a non-breaking way? Cleaner way I see is to introduce a new method and deprecate the old one. (I did ask what was best practice at the time, but this patch is now older so that might no longer apply).
  3. Sybille Peters commented on patch set 18 08/12/23, 09:36

    TypolinkSoftReferenceParser.php:46 Reply

    Good point. Should be checked as well. I am on it ...
  4. Oliver Klee commented on patch set 18 08/12/23, 10:59

    SoftReferenceParserInterface.php:46 Reply

    AFAIK, adding a new parameter and making it optional is non-breaking. If you do not want to add the new parameter yet, I would recommend creating a ticket instead of commented-out code.
  5. Sybille Peters commented on patch set 18 08/12/23, 14:29

    SoftReferenceParserInterface.php:46 Reply

    Adding the parameter without commenting it out in the interface will break classes implementing SoftReferenceParserInterface (if they do not implement the method with the $row parameter). This can be handled in the core, but if extensions write their own SoftReferenceParsers based on SoftReferenceParserInterface this will break. e.g. ``` PHP Fatal error: Declaration of TYPO3\CMS\Core\DataHandling\SoftReference\EmailSoftReferenceParser::parse(string $table, string $field, int $uid, string $content, string $structurePath = ''): TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult must be compatible with TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserInterface::parse(string $table, string $field, int $uid, string $content, string $structurePath = '', array $row = []): TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult in /var/www/t3coredev13/typo3/sysext/core/Classes/DataHandling/SoftReference/EmailSoftReferenceParser.php on line 25 ``` I am trying to do this in 2 steps as recommended a couple of months ago via Slack when this patch was created, so the change will be announced now and breaking in next core version, see https://typo3.slack.com/archives/C03AM9R17/p1685546320706729
  6. Sybille Peters uploaded patch set 19 V +1 08/12/23, 14:48

  7. Sybille Peters commented on patch set 18 08/12/23, 14:48

    TypolinkSoftReferenceParser.php:46 Reply

    Done
  8. core-ci voted on patch set 19 V +1 08/12/23, 14:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45418

  9. Stefan Bürk commented on patch set 19 08/15/23, 13:08

    SoftReferenceParserInterface.php:46 Reply

    I talked with Oliver Klee already about this. Adding my comments here for other reviewers. Olivers point was about avoiding outcomment code, which may become out of sync. That's usually a valid argument. However, in this special case the whole story is another one. The point is to integrate a further method argument into the interface, which is currently not possible without beeing breaking for developers implementing the interface. Adding the new argument as `@param` shows the available new argument for implementors, so they know that this argument can/should be passed. Mainly, because there is no native argument/typed argument. The outcommented argument is added, so people looking into the code see it directly there. This may be discussable, but I would say that this make sense. And with v14 there is no rethinking what to add - and if the @param comment is correct. It showes which argument(type) is planned for v14. This way to do it is nothing we came up with, but the way other open source libraries and framews are doing this. For example doctrine and symfony is using excatly that way to provide a upward awareness raising to be breaking on the next version. Implementing code can add the new argument directly and being compatible with v13 and v14 without having breaking issues in v14 than. That means, this is a sane way to having something breaking, but can be addressed in dual core version code without having hard headaches. Additionally, core implementations checks if the argument is passed or not, and emitting a deprecation that calling code should pass it. That does not help developers implementing the code, they just can adopt it. Example from symfony: * Inteface: https://github.com/symfony/symfony/pull/46567/files#diff-0acae78debaf9755135c1ca990f4c77d52df8ee1bdfc36d997230b6fdffa2171R24-R29 ``` public function createLoginLink( UserInterface $user, Request $request = null /*, int $lifetime = null */ ): LoginLinkDetails; ``` * Implemting code: https://github.com/symfony/symfony/pull/46567/files#diff-9a769cb79d1b50d804969e256e0443b7d98bc0e6bf421778ad3b22aa02849507R47 ``` public function createLoginLink( UserInterface $user, Request $request = null, int $lifetime = null ): LoginLinkDetails { // @todo implementation } ``` In this case, we need to live with the fact that a tool (phpstan) can't cope with the things we need to provide: The best possible way for extension/project developers and having a way to prepare before upgrading and doing dual version code in a easy way. Therefore, we accept the added phpstan baseline entry in this case. Until someone can come up with a better way to provide the best upgrade path for developers and making the tool happy I would say this is the only possible way for doing this on a interface level. And we are doing it the same way well known framework and libriers are doing it. I close this comment for now as resolved. The only point is - if we really should handle this as "deprecation" along with a deprecation rst file. Is this really a "deprecation" ? Maybe having a important rest file may be sufficient for this. Not sure. We can talk about that point. @Oliver Klee Is the explanation sufficient for you ?

    Deprecation-100934-DeprecateParseFunctionInSoftReferenceParsers.rst:57 Unresolved

    Maybe we can add a sentance / note that this can be done in v13 and avoiding being breaking in v14. Having one code for core 13 and v14 support. Can work for v12+v13 too - if not. It may be good to add a example to leave the method type out and retrieve the additional comment with `func_get_args()` along with a version check for v12 + v13 support in a custom implementation.
  10. Oliver Klee commented on patch set 19 08/15/23, 13:38

    SoftReferenceParserInterface.php:46 Reply

    Yes, this is sufficient for me. Thanks for writing this explanation (and for reaching out to me to talk beforehand)!
  11. Sybille Peters commented on patch set 19 CR -1 08/24/23, 05:01

    Open comments should get resolved

    Deprecation-100934-DeprecateParseFunctionInSoftReferenceParsers.rst:6

    Better to rename title: now sounds like function is being deprecated. We are only adding one optional argument.
  12. Sybille Peters uploaded patch set 20 CR -1 V +1 08/24/23, 05:14

  13. Sybille Peters commented on patch set 19 CR -1 08/24/23, 05:14

    Deprecation-100934-DeprecateParseFunctionInSoftReferenceParsers.rst:6 Reply

    Done
  14. core-ci voted on patch set 20 V +1 08/24/23, 05:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45772

  15. Sybille Peters uploaded patch set 21 V +1 08/24/23, 05:40

  16. core-ci voted on patch set 21 V +1 08/24/23, 05:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/45773

  17. Oliver Klee wrote 10/08/23, 13:24

    Removed cc Oliver Klee.
  18. Sybille Peters commented on patch set 21 06/22/24, 05:58

    NotifySoftReferenceParser.php:42

    I am not sure how to proceed here. I tried rebasing and resolving conflicts, but there have been considerable changes, e.g. typo3/sysext/core/Classes/DataHandling/SoftReference/NotifySoftReferenceParser.php was deleted in HEAD and modified in this patch. I will recheck if bug still exists in latest main. If yes, advice would be appreciated - whether we should proceed with this solution.
  19. Sybille Peters commented on patch set 21 06/22/24, 06:05

    NotifySoftReferenceParser.php:42 Reply Unresolved

    Issue https://forge.typo3.org/issues/100933 still reproducible
  20. Sybille Peters uploaded patch set 22 V +1 04/06/25, 07:59

  21. core-ci voted on patch set 22 V -1 04/06/25, 08:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77066

  22. Benni Mack uploaded patch set 23 V -1 09/25/26, 18:36

  23. core-ci voted on patch set 23 V -1 09/25/26, 18:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109293

  24. Benni Mack commented on patch set 24 V -1 10/02/26, 11:56

    Published edit on patch set 23.
  25. core-ci voted on patch set 24 V -1 10/02/26, 12:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109929