[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 21:35:34 CET 2008


> >>
> >> <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).
> 
> Yes, while I haven't seen this bug behaviour in "action" (haven't seen
> so many links on one page), I think we must handle that. To further
> consider this patch, Jan-Erik, can you please provide us a setup where
> this issue arises? Maybe an exported t3x file.
> 

For some reason, I'm unable to export a T3d file, but I have set a test at
http://t3dev.mocsystems.com 

On the page test1 config.prefixLocalAnchors is not set and on the page Test2
it is set to: config.prefixLocalAnchors = all (Both pages are un-cached)

The content is rather huge, and the HTML is not well-formatted, but this is
a real page from one of our customers (Apart from the design which is just a
dummy template).

The code is the current SVN Trunk. As can be seen test2 simply return an
empty page. I can prove a BE login to anyone interested (Just write me in
private).

> 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.

> Apart from that, we might also just issue:
> 
> 	ini_set('pcre.backtrack_limit', 1000000);
> 
> (1 million) somewhere when starting the TYPO3. The default PHP
> backtrack_limit is 100000 (100k), meaning that it won't backtrack after
> 100k bytes of data (which is used because of the non-greedy modifier in
> ".*?").
> 

I think this should at least be an option.

> Also we must have that value checked and a warning spit out in the
> Install Tool.
> 

That's a good idea. I'll make another patch for that though, I would prefer
to have the error checking included first.


Regards
Jan-Erik Revsbech
MOC Systems

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


More information about the TYPO3-team-core mailing list