[TYPO3-core] RFC #6415: Bug: preg_replace error on php5.2 sometimes resulting in empty pages.

Jan-Erik Revsbech janerik at mocsystems.com
Mon Jan 21 08:56:33 CET 2008


Hi again

> > on one of my sites. The regular expression is not correct, and should
> in my
> > opinion be '/(<(a|area).+href=")(#[^"]*")/i'
> 
> -1. Your expression will match to the second href while original will
> match to the first in this string:
> 
> <a href="#x1"> href="#x2">
> 
> Result for original regexp:
> 
> <a href="http://path/#x1"> href="#x2" </a>
> 
> Result for your regexp:
> 
> <a href="#x1"> href="http://path/#x2" </a>
> 
> Question mark in the first expression is used to find shortest match.
> 

Indeed you are right, I stand corrected (Always good to lean new stuff,
thanks). But I still think that there should at least be some error
checking. The attached patch now has the original regular expression, but
has the required error_checking (Still php 5.2 only).

Regards
Jan-Erik Revsbech
MOC Systems

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 6415_take2.diff
Type: application/octet-stream
Size: 1296 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20080121/878631c4/attachment.obj 


More information about the TYPO3-team-core mailing list