Project

General

Profile

Actions

Bug #98601

closed

typolink with parameter "/"

Added by Peter Linzenkirchner about 2 years ago. Updated 5 months ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2022-10-13
Due date:
% Done:

0%

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

Description

the following viewhelper:

<f:link.typolink parameter="/" ></f:link.typolink>

results in an empty link <a class="">

This affects especially the language menus because the language data handler delivers "link: /" for the homepage in the default language.

In constructions like

<f:link.typolink parameter="{languagemenu.link}" ></f:link.typolink>

this results in empty links for the homepage in the default language.

Reason is a modification in typo3/systext/frontend/Classes/Service/TypoLinkCodecService.php. This line from Typo3 vs. 10:

$value = str_replace(['\\', '"'], ['\\\\', '\\"'], $value);

changes to:

$parts = str_replace(['\\\\', '\\"'], ['\\', '"'], str_getcsv($typoLink, static::$partDelimiter));

str_getcsv removes single slashes.

Actions #1

Updated by Chris Müller almost 2 years ago

To circumvent this you can use just a plain "a" tag as the menu link has not to be processed via a view helper.

Actions #2

Updated by Benni Mack over 1 year ago

  • Status changed from New to Needs Feedback

Chris Müller wrote in #note-1:

To circumvent this you can use just a plain "a" tag as the menu link has not to be processed via a view helper.

I agree, I would do 100% the same: Using a menu "link" attribute again in a typolink will also double your DB requests for fetching the page again.

Maybe we need to update the docs for the menu processor / language menu processor that people should use <a> tags then.,

Actions #3

Updated by Philipp Kitzberger about 1 year ago

Maybe the f:link.typolink should even throw a warning (deprecation log?) when parameter is starting with a slash?

"Don't put rendered pre-rendered stuff where it doesn't belong" ;-)

Actions #4

Updated by Benni Mack 12 months ago

Philipp Kitzberger wrote in #note-3:

Maybe the f:link.typolink should even throw a warning (deprecation log?) when parameter is starting with a slash?

People actually use it like this as well "/fileadmin/myfile.zip", how should we handle this then?

Actions #5

Updated by Georg Ringer 5 months ago

  • Status changed from Needs Feedback to Rejected

hey Peter,

I am closing this issue. using just / in the f:link.typolink viewhelper should really not be something you would do. either use <f:link.page or just use a regular a-tag if you know already the url

Actions #6

Updated by Sascha Egerer 5 months ago

Georg Ringer wrote in #note-5:

hey Peter,

I am closing this issue. using just / in the f:link.typolink viewhelper should really not be something you would do. either use <f:link.page or just use a regular a-tag if you know already the url

I'm not really happy with just closing it, as it's still a bug. It works with /foo but does not work with / - so in my opinion, this is not acceptable behavior.

I think it should either throw an exception because it's not allowed, or the behavior should be consistent. Throwing an exception is, of course, not feasible, so in my opinion, the only way to solve the problem is to fix it.

It is not always obvious that typolink is called twice - at least not if you use third-party code such as fluid_components. Of course, it is unfavorable if typolink is called twice, but as I said, the behavior should still be consistent and not just happen in the event that only a / is passed.

Actions

Also available in: Atom PDF