$wgContLang->findVariantLink($part1, $title);
}
# Do infinite loop check
- if ( isset( $frame->loopCheckHash[$titleText] ) ) {
+ if ( !$frame->loopCheck( $title ) ) {
$found = true;
$text = "<span class=\"error\">Template loop detected: [[$titleText]]</span>";
wfDebug( __METHOD__.": template loop broken at '$titleText'\n" );
if ( $isDOM ) {
# Clean up argument array
$newFrame = $frame->newChild( $args, $title );
- # Add a new element to the templace loop detection hashtable
- $newFrame->loopCheckHash[$titleText] = true;
if ( $titleText !== false && $newFrame->isEmpty() ) {
# Expansion is eligible for the empty-frame cache
$label = '';
}
- $pout = $this->parse( $label,
- $this->mTitle,
- $this->mOptions,
- false, // Strip whitespace...?
- false // Don't clear state!
- );
- $html = $pout->getText();
+ $html = $this->recursiveTagParse( trim( $label ) );
$ig->add( $nt, $html );
function getArgument( $name ) {
return false;
}
+
+ /**
+ * Returns true if the infinite loop check is OK, false if a loop is detected
+ */
+ function loopCheck( $title ) {
+ return !isset( $this->loopCheckHash[$title->getPrefixedDBkey()] );
+ }
}
/**
$this->numberedArgs = $numberedArgs;
$this->namedArgs = $namedArgs;
$this->title = $title;
+ $pdbk = $title ? $title->getPrefixedDBkey() : false;
$this->titleCache = $parent->titleCache;
- $this->titleCache[] = $title ? $title->getPrefixedDBkey() : false;
+ $this->titleCache[] = $pdbk;
$this->loopCheckHash = /*clone*/ $parent->loopCheckHash;
+ if ( $pdbk !== false ) {
+ $this->loopCheckHash[$pdbk] = true;
+ }
$this->depth = $parent->depth + 1;
$this->numberedExpansionCache = $this->namedExpansionCache = array();
}
!! input
{{loop1}}
!! result
-<p><a href="/index.php?title=Loop1&action=edit" class="new" title="Loop1">loop1</a><!-- WARNING: template loop detected -->
+<p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
</p>
!! end
<td><div class="gallerybox" style="width: 155px;">
<div style="height: 152px;">Image5.svg</div>
<div class="gallerytext">
-<pre><a href="http://///////" class="external free" title="http://///////" rel="nofollow">http://///////</a>
-</pre>
+<p><a href="http://///////" class="external free" title="http://///////" rel="nofollow">http://///////</a>
+</p>
</div>
</div></td>
<td><div class="gallerybox" style="width: 155px;">