* (bug 13522) Fix fatal error in Parser::extractTagsAndParams
[lhc/web/wiklou.git] / includes / Preprocessor_Hash.php
index 64ed8eb..8579098 100644 (file)
@@ -804,6 +804,10 @@ class PPFrame_Hash implements PPFrame {
                {
                        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 );
@@ -924,7 +928,7 @@ class PPFrame_Hash implements PPFrame {
                                                $titleText = $this->title->getPrefixedDBkey();
                                                $this->parser->mHeadings[] = array( $titleText, $bits['i'] );
                                                $serial = count( $this->parser->mHeadings ) - 1;
-                                               $marker = "{$this->parser->mUniqPrefix}-h-$serial-{$this->parser->mMarkerSuffix}";
+                                               $marker = "{$this->parser->mUniqPrefix}-h-$serial-" . Parser::MARKER_SUFFIX;
                                                $s = substr( $s, 0, $bits['level'] ) . $marker . substr( $s, $bits['level'] );
                                                $this->parser->mStripState->general->setPair( $marker, '' );
                                                $out .= $s;
@@ -956,6 +960,7 @@ class PPFrame_Hash implements PPFrame {
                                }
                        }
                }
+               --$depth;
                return $outStack[0];
        }