Move the circular reference check to *after* redirect resolution, to avoid infinite...
authorTim Starling <tstarling@users.mediawiki.org>
Sun, 5 Apr 2009 15:01:25 +0000 (15:01 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sun, 5 Apr 2009 15:01:25 +0000 (15:01 +0000)
includes/parser/Parser.php

index 02f29cf..0f57d57 100644 (file)
@@ -2855,12 +2855,6 @@ class Parser
                                if($wgContLang->hasVariants() && $title->getArticleID() == 0){
                                        $wgContLang->findVariantLink( $part1, $title, true );
                                }
-                               # Do infinite loop check
-                               if ( !$frame->loopCheck( $title ) ) {
-                                       $found = true;
-                                       $text = '<span class="error">' . wfMsgForContent( 'parser-template-loop-warning', $titleText ) . '</span>';
-                                       wfDebug( __METHOD__.": template loop broken at '$titleText'\n" );
-                               }
                                # Do recursion depth check
                                $limit = $this->mOptions->getMaxTemplateDepth();
                                if ( $frame->depth >= $limit ) {
@@ -2910,6 +2904,14 @@ class Parser
                                }
                                $found = true;
                        }
+
+                       # Do infinite loop check
+                       # This has to be done after redirect resolution to avoid infinite loops via redirects
+                       if ( !$frame->loopCheck( $title ) ) {
+                               $found = true;
+                               $text = '<span class="error">' . wfMsgForContent( 'parser-template-loop-warning', $titleText ) . '</span>';
+                               wfDebug( __METHOD__.": template loop broken at '$titleText'\n" );
+                       }
                        wfProfileOut( __METHOD__ . '-loadtpl' );
                }