Project

General

Profile

Actions

Bug #18694

closed

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

Added by Gregor Hermens over 16 years ago. Updated about 16 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Content Rendering
Target version:
-
Start date:
2008-04-24
Due date:
% Done:

0%

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

Description

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

<a href="#asdf"> => <a href="[script_path]#asdf">

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)


Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #16347: problem with prefixLocalAnchorsClosedIngo Renner2006-07-15

Actions
Actions #1

Updated by Gregor Hermens over 16 years ago

Typo3 version 4.1.6

Actions #2

Updated by Daniel Hahler about 16 years ago

This is fixed in TYPO3_4-2, where both references ($1 and $3) are wrapped in curly braces.

Please close the bug.

Actions

Also available in: Atom PDF