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)
Updated by Stefan Neufeind almost 16 years ago
While the patch can be seen as a workaround, maybe we should define an internal format for creating link-tags with additional parameters, e.g.
<LINK 18?abc> or together with a content-element-id <LINK 18?abc#222>
Might that find consent?
Updated by Stefan Neufeind almost 16 years ago
Fix for the fix ... checking for '?' is wrong, as you might have guessed. Correct is:
--- 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']:'');
Updated by Stefan Neufeind over 15 years ago
Still valid/needed for 4.2.6. Please let me know if you which an updated patch against 4.2.6 or something. Any chance to maybe still get this rolled into 4.3?
Updated by Alban Cousinie about 15 years ago
The issue is present in Typo3 4.2.8 as well
Updated by Stefan Neufeind almost 15 years ago
Against 4.3.0:
--- class.t3lib_parsehtml_proc.orig.php 2009-11-30 10:29:44.000000000 0100
++ class.t3lib_parsehtml_proc.php 2010-02-16 11:23:00.000000000 0100@ -1555,7 +1555,8
@
$pp = explode('id=',$uP['query']);
$parameters = explode('&', $pp1);
$id = array_shift($parameters);
- if ($id) {
//if ($id) {
+ if (($id) && (strpos($id,'&') === false)) {
$info['pageid']=$id;
$info['cElement']=$uP['fragment'];
$info['url']=$id.($info['cElement']?'#'.$info['cElement']:'');
Updated by Stefan Neufeind almost 15 years ago
Updated by Alexander Opitz over 11 years ago
- Status changed from New to Needs Feedback
- Target version deleted (
0)
The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?
Updated by Alexander Opitz about 11 years ago
- Status changed from Needs Feedback to Closed
- Is Regression set to No
No feedback for over 90 days.