diff options
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -352,7 +352,17 @@ function match($pattern, $string, $p = array()) setlocale(LC_CTYPE, $oldlocale); if (!$r) # no match + { + static $backtrackerror; + + if (!isset($backtrackerror)) + $backtrackerror = defined('PREG_BACKTRACK_LIMIT_ERROR') ? constant('PREG_BACKTRACK_LIMIT_ERROR') : 0; + + if ($backtrackerror && preg_last_error() == $backtrackerror) # Silence phpversionlint.php commit hook: function_exists('preg_last_error') + it::error("Exceeded pcre.backtrack_limit of " . ini_get('pcre.backtrack_limit') . " bytes"); + $result = $p['all'] ? array() : null; + } else if (count($m) == 1) # no capture $result = $m[0]; else if (count($m) == 2) # one capture |