Project

General

Profile

Actions

Bug #15693

closed

typoLink is htmlspecialchared, so the links are wrong

Added by Franz Holzinger over 18 years ago. Updated over 18 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2006-02-21
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.0
PHP Version:
4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

With the Beta3 the links for the shop system are generated with wrong parameters like <a href="index.php?id=51&amp;backPID=13&amp;tt_products=2094">
where it should have been
<a href="index.php?id=51&backPID=13&amp;tt_products=2094">

This error comes from class.tslib_content.php
function typoLink($linktxt, $conf).

$finalTagParts['url']=$this->lastTypoLinkUrl;
However $this->lastTypoLinkUrl contains parameters separated with '&'.

$res = '<a href="'.htmlspecialchars($finalTagParts['url']).'"'.($title?' title="'.$title.'"':'').$finalTagParts['targetParams'].($linkClass?' class="'.$linkClass.'"':'').$finalTagParts['aTagParams'].'>';

Here the wrong htmlspecialchars it applied to the url with parameters.

Debug Infos:
--------------------------
$conf
String (2) parameter 51
String (36) additionalParams &backPID=13&tt_products=2091

[debug] in
String (2) $link_param 51

Array (4)
$finalTagParts
String (1) aTagParams
String (51) url index.php?id=51&backPID=13&tt_products=2091
String (0) targetParams
String (4) TYPE page

$res <a href="index.php?id=51&amp;backPID=13&amp;tt_products=2091" >


(issue imported from #M2657)


Files

correctHtmlLinks.diff (1.96 KB) correctHtmlLinks.diff Administrator Admin, 2006-02-21 21:58
Actions #1

Updated by Franz Holzinger over 18 years ago

where it should have been
<a href="index.php?id=51&backPID=13&tt_products=2094">

Actions #2

Updated by Michael Stucki over 18 years ago

I don't think this is a bug. In an <a> tag, the href attribute must be htmlspecialchar'ed. So what's wrong here?

Actions #3

Updated by Franz Holzinger over 18 years ago

This has however been different in TYPO3 3.8.1.
See the source code from http://bananaguard.de/index.php?id=55

With TYPO3 4.0 it is like this:
­-------------------------
<form method="post" action="index.php?id=13&amp;backPID=13" name="ShopForm">

<div class="Browse"><div align="right">  <b>1</b> <a href="index.php?id=13&amp;backPID=13&amp;begin_at=10">2</a><a href="index.php?id=13&amp;backPID=13&amp;begin_at=20">3</a><a href="index.php?id=13&amp;backPID=13&amp;begin_at=30">4</a><a href="index.php?id=13&amp;backPID=13&amp;begin_at=40">5</a><a href="index.php?id=13&amp;backPID=13&amp;begin_at=50">6</a><a href="index.php?id=13&amp;backPID=13&amp;begin_at=60">7</a><a href="index.php?id=13&amp;backPID=13&amp;begin_at=70">8</a><a href="index.php?id=13&amp;backPID=13&amp;begin_at=80">9</a><a href="index.php?id=13&amp;backPID=13&amp;begin_at=90">10</a><a href="index.php?id=13&amp;backPID=13&amp;begin_at=100">11</a><a href="index.php?id=13&amp;backPID=13&amp;begin_at=110">12</a>  <a href="index.php?id=13&amp;backPID=13&amp;begin_at=10">weiter</a></div></div>

Actions #4

Updated by Franz Holzinger over 18 years ago

http://de.selfhtml.org/html/allgemein/referenzieren.htm
This significates that the '&' must not be HTML encoded in the URL of the link.

Actions #5

Updated by Oliver Klee over 18 years ago

Franz, that page in SelfHTML is about relative and absolute links, not about whether the ampersand needs to be encoded or not.

Ampersands need to be written as HTML entities as long as they're not part of an entity:

http://www.w3.org/TR/html401/appendix/notes.html#h-B.2.2
http://www.w3.org/TR/xhtml1/#C_12

Actions

Also available in: Atom PDF