From 92bcfa2abd28df99c56547421200f218edcb4b68 Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Wed, 19 Mar 2008 20:53:45 +0100 Subject: [PATCH] completed PCRE error checking in lexer darcs-hash:20080319195345-7ad00-2def5dffd099cfb13863f73122821dc2e48b9b1b.gz --- inc/parser/lexer.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/inc/parser/lexer.php b/inc/parser/lexer.php index cf892e0bc..375f9e5f9 100644 --- a/inc/parser/lexer.php +++ b/inc/parser/lexer.php @@ -115,7 +115,20 @@ class Doku_LexerParallelRegex { if (! preg_match($this->_getCompoundedRegex(), $subject, $matches)) { if(function_exists('preg_last_error')){ $err = preg_last_error(); - if($err == 2) msg('A PCRE backtrack error occured. Try to increase the pcre.backtrack_limit in php.ini',-1); + switch($err){ + case PREG_BACKTRACK_LIMIT_ERROR: + msg('A PCRE backtrack error occured. Try to increase the pcre.backtrack_limit in php.ini',-1); + break; + case PREG_RECURSION_LIMIT_ERROR: + msg('A PCRE recursion error occured. Try to increase the pcre.recursion_limit in php.ini',-1); + break; + case PREG_BAD_UTF8_ERROR: + msg('A PCRE UTF-8 error occured. This might be caused by a faulty plugin',-1); + break; + case PREG_INTERNAL_ERROR: + msg('A PCRE internal error occured. This might be caused by a faulty plugin',-1); + break; + } } $split = array($subject, "", ""); -- GitLab