r93186 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93185‎ | r93186 | r93187 >
Date:14:51, 26 July 2011
Author:macbre
Status:deferred
Tags:
Comment:
GoogleMaps: avoid infinite loop

GoogleMaps extension allows the user to provide title of the page to be included as a marker description. This check here is to prevent recursive parsing if the provided title is the same as the current page.

http://www.mediawiki.org/wiki/Extension_talk:Google_Maps#Inifinite_loop_when_trying_to_fetch_the_content_of_the_current_page_as_a_marker_description
Modified paths:
  • /trunk/extensions/GoogleMaps/GoogleMaps.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GoogleMaps/GoogleMaps.body.php
@@ -556,6 +556,16 @@
557557 global $wgUser;
558558 $parsed = self::parseWikiText($pParser, $pLocalParser, preg_replace('/\r\n/', '<br />', $pCaption), $pParser->mTitle, $pParser->mOptions);
559559 $title = Title::newFromText($pTitle);
 560+
 561+ // GoogleMaps extension allows user to provide title of the page to be included as
 562+ // a marker description. This check here is to prevent recursive parsing if the provided title
 563+ // is the same as the current page.
 564+ if ($title instanceof Title && $pLocalParser->mTitle instanceof Title) {
 565+ if ($title->equals($pLocalParser->getTitle())) {
 566+ $title = null;
 567+ }
 568+ }
 569+
560570 $revision = is_null($title) ? null :
561571 Revision::newFromTitle($title);
562572 $parsedArticleText = is_null($revision) ? null :

Status & tagging log