Re: [pcre-dev] [Bug 957] New: Unexpected PREG_BACKTRACK_LIMI…

Page principale
Supprimer ce message
Auteur: Philip Hazel
Date:  
À: 957
CC: pcre-dev
Sujet: Re: [pcre-dev] [Bug 957] New: Unexpected PREG_BACKTRACK_LIMIT_ERROR
On Tue, 26 Jan 2010, Laurent Raufaste wrote:

> I'm using PCRE 6.7.7.4 2008-07-04 with PHP, and I encountered a problem. The
> PHP developpers told me to report it to you.


I know nothing about PHP, but I guess that's a PHP variant of PCRE 6.7
(July 2006), which is now a very old version. The current release of
PCRE is 8.01. Many bugs have been fixed in the meantime.

> When I try to preg_replace a 2654 long string, I get a
> PREG_BACKTRACK_LIMIT_ERROR


However, with any version of PCRE, it is trivially easy to write a regex
that requires a vast amount of resources for tracebacks because the
search tree is very large indeed.

> Why does it hits the limit with a short string like this ?


There are discussions about this kind of thing in the pcreperform and
pcrestack man pages.

Philip

--
Philip Hazel