[TYPO3-core] RFC #6415: Bug: preg_replace error on php5.2 sometimes resulting in empty pages.
Martin Kutschker
martin.kutschker-n0spam at no5pam-blackbox.net
Sun Apr 6 12:39:51 CEST 2008
Jan-Erik Revsbech schrieb:
>> The error checking in the patch looks all right, haven't tested it,
>> thou. The phpdoc comment change for the return value is not correct, as
>> it still returns "void" and modifies $this->content.
>>
>
> Right. The attached patch corrects this.
Use this regexp to avoid one extra backtracking item (the ?: for a|area):
/(<(?:a|area).*?href=")(#[^"]*")/i
Does it help bit? Mind that you have to use $1 and $2 after that change.
Another option would be to use an assertion. This should (untested)
match any string followed by " that is preceeded by an opening a or area
tag:
/(?<=<(?:a|area).*?href="#)([^"]*)"/i
In this case only '$1"' is needed as replacement string.
And please check preg_last_error() with function_exists() or with a PHP
version check as TYPO3 (despite the announcements) requires only PHP 5.1
and it should stay so.
Masi
More information about the TYPO3-team-core
mailing list