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

Francois Suter fsuter at cobweb.ch
Tue Oct 21 13:42:53 CEST 2008


Hi all,

> Solution:
> 1: Change the regular expression to a non-faulty one
> 2: Introduce some error checking. Since php 5.2 a call to preg_last_error
> will give some insight into the result of the last call to preg_ functions.
> The patch here checks if there was an error, and if yes, then return the
> unsubstitued content (in order to avoid empty pages) and  write an entry to
> the syslog. 
> 
> Notes:
> The patch requires php 5.2 to run.

I have tested and reviewed this patch and am +1 to it.

I have taken into accounts the following of Masi's suggestions:

1) test if function preg_last_error() exists

2) make the brackets around a|area non-capturing, although this didn't 
help with the backtrack limit.

Masi suggested another regex, but it was untested from his side. The 
current patch work, so improving the current could/should be another 
patch IMO.

On top of that, I removed the change to the @return statement, which was 
wrong. The method still returns void.

Attached is the revised patch. Obviously the target versions are now 4.2 
and trunk.

Cheers

-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 6415-revised.patch
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20081021/c050c91f/attachment.txt 


More information about the TYPO3-team-core mailing list