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

Steffen Kamper info at sk-typo3.de
Fri Oct 31 19:50:02 CET 2008


Hi,

Francois Suter schrieb:
> 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
> 

+1 by reading and testing

vg Steffen


More information about the TYPO3-team-core mailing list