* stop the parser before it hits the xdebug limit.
*/
$wgMaxTemplateDepth = 40;
+$wgMaxPPExpandDepth = 40;
$wgExtraSubtitle = '';
$wgSiteSupportPage = ''; # A page where you users can receive donations
* Maximum number of links to a redirect page listed on
* Special:Whatlinkshere/RedirectDestination
*/
-$wgMaxRedirectLinksRetrieved = 500;
\ No newline at end of file
+$wgMaxRedirectLinksRetrieved = 500;
var $mTargetLanguage; # Overrides above setting with arbitrary language
var $mMaxIncludeSize; # Maximum size of template expansions, in bytes
var $mMaxPPNodeCount; # Maximum number of nodes touched by PPFrame::expand()
+ var $mMaxPPExpandDepth; # Maximum recursion depth in PPFrame::expand()
var $mMaxTemplateDepth; # Maximum recursion depth for templates within templates
var $mRemoveComments; # Remove HTML comments. ONLY APPLIES TO PREPROCESS OPERATIONS
var $mTemplateCallback; # Callback for template fetching
function initialiseFromUser( $userInput ) {
global $wgUseTeX, $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages;
global $wgAllowExternalImagesFrom, $wgAllowSpecialInclusion, $wgMaxArticleSize;
- global $wgMaxPPNodeCount, $wgMaxTemplateDepth;
+ global $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth;
$fname = 'ParserOptions::initialiseFromUser';
wfProfileIn( $fname );
if ( !$userInput ) {
$this->mTargetLanguage = null; // default depends on InterfaceMessage setting
$this->mMaxIncludeSize = $wgMaxArticleSize * 1024;
$this->mMaxPPNodeCount = $wgMaxPPNodeCount;
+ $this->mMaxPPExpandDepth = $wgMaxPPExpandDepth;
$this->mMaxTemplateDepth = $wgMaxTemplateDepth;
$this->mRemoveComments = true;
$this->mTemplateCallback = array( 'Parser', 'statelessFetchTemplate' );
}
function expand( $root, $flags = 0 ) {
+ static $depth = 0;
if ( is_string( $root ) ) {
return $root;
}
return '<span class="error">Node-count limit exceeded</span>';
}
+ if ( $depth > $this->parser->mOptions->mMaxPPExpandDepth ) {
+ return '<span class="error">Expansion depth limit exceeded</span>';
+ }
+ ++$depth;
+
if ( $root instanceof PPNode_DOM ) {
$root = $root->node;
}
}
}
}
+ --$depth;
return $outStack[0];
}
{
return '<span class="error">Node-count limit exceeded</span>';
}
+ if ( $depth > $this->parser->mOptions->mMaxPPExpandDepth ) {
+ return '<span class="error">Expansion depth limit exceeded</span>';
+ }
+ ++$depth;
$outStack = array( '', '' );
$iteratorStack = array( false, $root );
}
}
}
+ --$depth;
return $outStack[0];
}