From: Tim Starling Date: Thu, 23 Oct 2008 14:40:10 +0000 (+0000) Subject: Fixed the expansion depth limit feature, broken by Brion in r32550. This may be the... X-Git-Tag: 1.31.0-rc.0~44635 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=ba186782776755f6041cb15e218c29826ed4d9a6;p=lhc%2Fweb%2Fwiklou.git Fixed the expansion depth limit feature, broken by Brion in r32550. This may be the cause of the reported regressions when upgrading from 1.12 to 1.13 in the presence of certain extensions, e.g. mwusers.com/forums/showthread.php?t=8651 --- diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 6ba48e878b..f0f5a8061b 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -770,6 +770,7 @@ class PPFrame_DOM implements PPFrame { /** * Recursion depth of this frame, top = 0 + * Note that this is NOT the same as expansion depth in expand() */ var $depth; @@ -826,7 +827,7 @@ class PPFrame_DOM implements PPFrame { } function expand( $root, $flags = 0 ) { - static $depth = 0; + static $expansionDepth = 0; if ( is_string( $root ) ) { return $root; } @@ -837,10 +838,10 @@ class PPFrame_DOM implements PPFrame { return 'Node-count limit exceeded'; } - if ( $depth > $this->parser->mOptions->mMaxPPExpandDepth ) { + if ( $expansionDepth > $this->parser->mOptions->mMaxPPExpandDepth ) { return 'Expansion depth limit exceeded'; } - ++$depth; + ++$expansionDepth; if ( $root instanceof PPNode_DOM ) { $root = $root->node; @@ -1029,7 +1030,7 @@ class PPFrame_DOM implements PPFrame { } } } - --$depth; + --$expansionDepth; wfProfileOut( __METHOD__ ); return $outStack[0]; } diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index 867878dccd..5473286e85 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -758,6 +758,7 @@ class PPFrame_Hash implements PPFrame { /** * Recursion depth of this frame, top = 0 + * Note that this is NOT the same as expansion depth in expand() */ var $depth; @@ -810,6 +811,7 @@ class PPFrame_Hash implements PPFrame { } function expand( $root, $flags = 0 ) { + static $expansionDepth = 0; if ( is_string( $root ) ) { return $root; } @@ -818,10 +820,10 @@ class PPFrame_Hash implements PPFrame { { return 'Node-count limit exceeded'; } - if ( $this->depth > $this->parser->mOptions->mMaxPPExpandDepth ) { + if ( $expansionDepth > $this->parser->mOptions->mMaxPPExpandDepth ) { return 'Expansion depth limit exceeded'; } - ++$this->depth; + ++$expansionDepth; $outStack = array( '', '' ); $iteratorStack = array( false, $root ); @@ -974,7 +976,7 @@ class PPFrame_Hash implements PPFrame { } } } - --$this->depth; + --$expansionDepth; return $outStack[0]; }