Issue Bug Closed

#51440htmlSpecialChars not working for typolink.returnLast = url

Henrik Ziegenhain 08/28/13, 13:11 updated 03/21/20, 15:37

Description

It is not possible to escape special chars like “&” in a returned URL when you are working with additionalParams.

The following is not working

 10 = TEXT
 10 {
   typolink{
     parameter = 79
     additionalParams = &tx_indexedsearch_pi2[action]=search&tx_indexedsearch_pi2[controller]=Search
     additionalParams.stdWrap.htmlSpecialChars = 1
     returnLast = url
   }
   wrap = <form action="|" method="post" name="searchform" id="tx_indexedsearch">
  }

The generated HTML is the following

<form action="index.php?id=79&amp%3Btx_indexedsearch_pi2%5Baction%5D=search&amp%3Btx_indexedsearch_pi2%5Bcontroller%5D=Search" method="post" name="searchform" id="tx_indexedsearch">

As you see, the & is transformed to &amp – the semicolon is missing.

If you remove the htmlSpecialChars = 1 from above completly the generated HTML is

<form action="index.php?id=79&tx_indexedsearch_pi2%5Baction%5D=search&tx_indexedsearch_pi2%5Bcontroller%5D=Search" method="post" name="searchform" id="tx_indexedsearch">

This is also not valid HTML.

Why is $this->lastTypoLinkUrl in \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer not htmlspecialchared directly before returning? Are there any sideeffects?

Reviews 0

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