Issue Bug Closed

#18694config.prefixLocalAnchors = all destroys links when $scriptPath starts with a number

Gregor Hermens 04/24/08, 19:27 updated 10/30/08, 22:50

Description

TS Setup config.prefixLocalAnchors = all should insert the script path into all links with local anchors:

=>

This is done in /typo3/sysext/cms/tslib/class.tslib_fe.php in line 3713, function prefixLocalAnchorsWithScript():

$this->content = preg_replace(‘/(<(a|area).+href=”)(#[^”]*”)/i’,’$1’ . htmlspecialchars($scriptPath) . ‘$3’,$this->content);

If $scriptPath starts with a number, the replacement string reads ‘$1[number]…’, causing the first reference to be omitted completely.

Fix: Put the first reference into braces:
$this->content = preg_replace(‘/(<(a|area).+href=”)(#[^”]*”)/i’,’${1}’ . htmlspecialchars($scriptPath) . ‘$3’,$this->content);

See http://www.php.net/manual/en/function.preg-replace.php for details.

(issue imported from #M8240)

Reviews 0

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