Index: class.tslib_fe.php =================================================================== --- class.tslib_fe.php (revision 3517) +++ class.tslib_fe.php (working copy) @@ -3735,7 +3735,13 @@ */ function prefixLocalAnchorsWithScript() { $scriptPath = substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'),strlen(t3lib_div::getIndpEnv('TYPO3_SITE_URL'))); - $this->content = preg_replace('/(<(a|area).*?href=")(#[^"]*")/i','${1}' . htmlspecialchars($scriptPath) . '${3}',$this->content); + $original_content = $this->content; + $this->content = preg_replace('/(<(a|area).+href=")(#[^"]*")/i','${1}' . htmlspecialchars($scriptPath) . '${3}',$original_content); + if(preg_last_error()>0) { + //The was an error in call to preg_replace, so keep original content (Behavior prior t PHP 5.2). + t3lib_div::sysLog('preg_replace returned error-code: ' . preg_last_error().' in function prefixLocalAnchorsWithScript. Replacement not done!' , 'cms', 4); + $this->content = str_replace(' href="#',' href="'.htmlspecialchars($scriptPath).'#',$original_content); + } } /**