Issue Bug Closed

#81226LegacyLinkNotationConverter does not work correctly with old links including page type and parameters

Robert Vock 05/15/17, 10:47 updated 05/07/19, 12:17

Description

TYPO3 7 and below allowed the following as Typolink: PageID,PageType,parameters:
https://docs.typo3.org/typo3cms/TyposcriptReference/7.6/Functions/Typolink/

If I was using 1,0,&param=2 as typolink, the type-parameter was stripped from the URL as it has the default value. In TYPO3 8, the typeNum will appear in the URL.

The LegacyLinkNotationConverter explodes the type, but the resulting pagetype still contains a trailing comma:
LegacyLinkNotationConverter.php#L154

During link generation, the PageLinkBuilder checks, if pagetype is set and uses it, if is non-empty:
PageLinkBuilder.php#L80

“0,” is non-empty and is used instead of 0. But later it is cast to an integer.

I see two possible fixes:
  1. rtrim on $data or $result[pagetype] in LegacyLinkNotationConverter.php
  2. Force integer pageType in PageLinkBuilder.php#L80 = (int)$linkDetails[‘pagetype’] ?? 0;

Reviews 3