Project

General

Profile

Actions

Bug #101897

closed

typolink userfunc changes linktext to a pipe

Added by Mike Street about 1 year ago. Updated 4 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Content Rendering
Target version:
-
Start date:
2023-09-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

Description

We have some code which uses the `userFunc` functionality of `typolink` - since upgrading to v11, the `$linkText` variable gets set to a pipe `|` (this worked in v10)

I have narrowed this down to the `lastTypoLinkResult->withAttributes()` method call within the `ContentObjectRenderer.php` file (link to line)

It seems this line replaces the whole of the `lastTypoLinkResult` but sets the title back to the default of `|`.

I have managed to resolve this locally by adding `->withLinkText($linkText)` to the end of this line - which passes the existing link text through to the new `LinkResult` class.

This can be varified by outputing `$this->lastTypoLinkResult->getLinkText()` before and after the `if` statement: https://github.com/TYPO3/typo3/blob/11.5/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php#L4956-L4962

Actions #1

Updated by Mike Street about 1 year ago

We have some code which uses the userFunc functionality of typolink - since upgrading to v11, the $linkText variable gets set to a pipe | (this worked in v10)

I have narrowed this down to the lastTypoLinkResult->withAttributes() method call within the ContentObjectRenderer.php file (link to line)

It seems this line replaces the whole of the lastTypoLinkResult but sets the title back to the default of |.

I have managed to resolve this locally by adding ->withLinkText($linkText) to the end of this line - which passes the existing link text through to the new LinkResult class.

This can be verified by outputting $this->lastTypoLinkResult->getLinkText() before and after the if statement: https://github.com/TYPO3/typo3/blob/11.5/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php#L4956-L4962.

I'm happy to submit a patch/fix for this if desired)

(Edit to add correct syntax highlighting & fix some typos)

Actions #2

Updated by Georg Ringer about 1 year ago

please go ahead and submit a patch to gerrit, thanks!

Actions #3

Updated by Gerrit Code Review about 1 year ago

  • Status changed from New to Under Review

Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80988

Actions #4

Updated by Mike Street about 1 year ago

Gerrit Code Review wrote in #note-3:

Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80988

From my investigations it looks like this only affects TYPO3 v11

Actions #5

Updated by Georg Ringer 6 months ago

have you seen the detailed feedback at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80988

or is the issue still relevant for you?

Actions #6

Updated by Mike Street 4 months ago

Georg Ringer wrote in #note-5:

have you seen the detailed feedback at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80988

or is the issue still relevant for you?

Sorry for the very delayed reply to any of this - the emails from forge seemed to have been going into my spam.

As no-one else has reported it (and it wasn't able to be replicated) I would say this was a rogue bit of code elsehwere.

Happy for this to be closed - thanks for the support and patience!

Actions #7

Updated by Garvin Hicking 4 months ago

  • Status changed from Under Review to Closed

Thanks for the feedback! Closing this now as requested; if it becomes an issue again, please let us know :)

Actions

Also available in: Atom PDF