From the PCRE source code, this error is returned when match () is called recursively more than 1,000,000 times:
if (md->match_call_count++ >= md->match_limit) RRETURN(PCRE_ERROR_MATCHLIMIT);
This conversion to the error "PHP_PCRE_BACKTRACK_LIMIT_ERROR" here .
According to the pcreapi man page (see https://serverfault.com/a/408272/140833 ):
, PCRE , match(), ( ). , match_limit, , , , . , , .
, - " ". , 1 1 .
" " regex:
<?php
ini_set('pcre.backtrack_limit', 100);
for ($len = 1000; $len <= 1001; $len++) {
$x = str_repeat("x", $len);
$ret = preg_match("/x+x+y/", $x);
echo "len = " . $len . "\n";
echo "preg_match = " . $ret . "\n";
echo "PREG_BACKTRACK_LIMIT_ERROR = " . PREG_BACKTRACK_LIMIT_ERROR . "\n";
echo "preg_last_error = " . preg_last_error() . "\n";
echo "\n";
}
: https://3v4l.org/EpaNC, :
len = 1000
preg_match = 0
PREG_BACKTRACK_LIMIT_ERROR = 2
preg_last_error = 0
len = 1001
preg_match =
PREG_BACKTRACK_LIMIT_ERROR = 2
preg_last_error = 2