summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/common.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/inc/common.php b/inc/common.php
index a1325e2fc..e9c4d7406 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -330,9 +330,18 @@ function checkwordblock(){
if(!$conf['usewordblock']) return false;
$blockfile = file('conf/wordblock.conf');
- //read file in chunks of 600 - this should work around the
- //MAX_PATTERN_SIZE in PCRE
- while($blocks = array_splice($blockfile,0,600)){
+ //how many lines to read at once (to work around some PCRE limits)
+ if(version_compare(phpversion(),'4.3.0','<')){
+ //old versions of PCRE define a maximum of parenthesises even if no
+ //backreferences are used - the maximum is 99
+ //this is very bad performancewise and may even be too high still
+ $chunksize = 40;
+ }else{
+ //read file in chunks of 600 - this should work around the
+ //MAX_PATTERN_SIZE in modern PCRE
+ $chunksize = 600;
+ }
+ while($blocks = array_splice($blockfile,0,$chunksize)){
$re = array();
#build regexp from blocks
foreach($blocks as $block){