diff options
author | Christian Schneider | 2009-08-20 14:42:19 +0000 |
---|---|---|
committer | Christian Schneider | 2009-08-20 14:42:19 +0000 |
commit | 21aae88fc189bc2672ef563f6ed7ae42a3b8634e (patch) | |
tree | 3f758cf64928a4a1d9dd419b086da5e5923dd445 | |
parent | cae02168e1de4c2a5022660fe90d93fb29438523 (diff) | |
download | itools-21aae88fc189bc2672ef563f6ed7ae42a3b8634e.tar.gz itools-21aae88fc189bc2672ef563f6ed7ae42a3b8634e.tar.bz2 itools-21aae88fc189bc2672ef563f6ed7ae42a3b8634e.zip |
Warn when we hit pcre.backtracking_limit
-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 |