Issue Bug Closed

#84287linkhandler config.recordLinks.tx_news.parameter = 1 fails

Anonymous 03/15/18, 13:26 updated 03/23/20, 15:35

Description

scenario
I have a link to an detail page (for simplicity let’s say a news). I create a Typolink using Typoscript.

lib.link = TEXT
lib.link.typolink.parameter = t3://record?identifier=tx_news&uid=5

Now the config.recordLinks looks like this

config.recordLinks.tx_next {
    typolink.parameter = 1
}

Expected behaviour
lib.link should create a link to page did 1

Actual behaviour
PHP Warning: trim() expects parameter 1 to be string, array given in /var/www/html/vendor/typo3/cms/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 5667

What happened?
\TYPO3\CMS\Frontend\Typolink\DatabaseRecordLinkBuilder::build uses array_merge_recursive to combine both typolinks. A quick test:

php -r "var_dump(array_merge_recursive(['parameter' => 'link1'], ['parameter' => 'link2']));"
array(1) {
  'parameter' =>
  array(2) {
    [0] =>
    string(5) "link1"
    [1] =>
    string(5) "link2"
  }
}

So typolink.parameter becomes an array which breaks the typolink method.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.