0

I am facing the following error:

PHP regular expression limit reached (pcre.backtrack_limit)

You may not be able to visit this page because of:

  • an out-of-date bookmark/favourite
  • a search engine that has an out-of-date listing for this site
  • a mistyped address
  • you have no access to this page
  • The requested resource was not found.
  • An error has occurred while processing your request.

I have also tried to add the following code in configuration.php and index.php:

ini_set('pcre.backtrack_limit',1000000); 
ini_set('pcre.recursion_limit',1000000);

Unfortunately it has not worked. What is happening here and what can be done to address it?

Alan Moore
  • 73,866
  • 12
  • 100
  • 156
Umesh Sehta
  • 10,555
  • 5
  • 39
  • 68
  • 3
    10000000 is the default value, try setting it to more or better yet: fix your regex instead (you probably have [catastrophic backtracking](http://www.regular-expressions.info/catastrophic.html) at this point). And how do you know this value is exceeded? PHP doesn't tell you this explicitly. [More info](http://stackoverflow.com/a/27868983/3764814) about this. – Lucas Trzesniewski Apr 08 '15 at 16:21
  • 1
    You need to search the code to find the involved pattern and correct it. Setting up the backtracking limit or the recursion limit with higher values will not solve the problem. – Casimir et Hippolyte Apr 08 '15 at 19:15
  • Grammar language updates to increase readability. – Matt Apr 08 '15 at 22:04
  • 2
    Edit your post to include your regex. There is almost certainly a better way to write it so that this error does not occur. Sometimes regexes are just not the right tool and you may be better off writing a parsing routine using functions like `strcspn`, `strtok`, etc. They take longer to write but can perform better. – Walf Apr 09 '15 at 01:11
  • What php version are you using ? – cb0 Sep 21 '15 at 09:41

0 Answers0