Bug #19706
closedInternal links with additional parameters "destroyed" when saving content-elements
0%
Description
Create a content-element, disable RTE and directly insert this code:
<p><a href="http://example.com/index.php?id=18&amp;abc=def">123</a></p>
This link works if opened in a browser. However when saving that content-element the link gets destroyed.
Reason is that the "external" URL is parsed into a <LINK ...>-statement (internal link). However there is (afaik) no defined way to attach additional parameters. There is only <LINK 18> or <LINK 18#14245> (link to a specific content-element).
The above link gets parsed into a pageid "18&abc=def" which then is a "non existant page", gets rendered with a yellow background ("no page found"-error) etc.
That parsing is done in t3lib/class.t3lib_parsehtml_proc.php
Reason for having such "broken" links in content-elements is that they were used in the past in some typo3-installation. The page always looked fine and worked. However when the content-elements are opened and saved again the links get destroyed. It would be good to at least have a "workaround" for not destroying them.
Problem still exists in 4.2.3. A simple patch/workaround which was created against 4.2.2 is attached below. This one simply checks if there a question-mark in the id-field (which can't be right) and in that case it doesn't try to parse the URL into an internal link but simply leaves it as an "external" link for the moment.
--- class.t3lib_parsehtml_proc.orig.php 2008-12-16 16:27:27.000000000 0100
++ class.t3lib_parsehtml_proc.php 2008-12-17 00:54:03.000000000 0100@ -1541,7 +1541,8
@
} elseif (!trim($uP['path']) || !strcmp($uP['path'],'index.php')) {
$pp = explode('id=',$uP['query']);
$id = trim($pp1);
- if ($id) {
// if ($id) {
+ if (($id) && (strpos($id,'?') !== false)) {
$info['pageid']=$id;
$info['cElement']=$uP['fragment'];
$info['url']=$id.($info['cElement']?'#'.$info['cElement']:'');
(issue imported from #M9959)