r63853 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63852‎ | r63853 | r63854 >
Date:01:46, 17 March 2010
Author:yaron
Status:deferred
Tags:
Comment:
Fixing "Category" regexp yet again; never thought to actually test the thing last time
Modified paths:
  • /trunk/extensions/SemanticForms/specials/SF_Templates.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_Templates.php
@@ -72,12 +72,12 @@
7373
7474 $template_text = $template_article->getContent();
7575 $cat_ns_name = $wgContLang->getNsText( 14 );
76 - if ( preg_match_all( "/\[\[(Category|$cat_ns_name):(.*)\]\]/", $template_text, $matches ) ) {
 76+ if ( preg_match_all( "/\[\[(Category|$cat_ns_name):([^\]]*)\]\]/", $template_text, $matches ) ) {
7777 // get the last match - if there's more than one
7878 // category tag, there's a good chance that the last
7979 // one will be the relevant one - the others are
8080 // probably part of inline queries
81 - return trim( end( $matches[1] ) );
 81+ return trim( end( $matches[2] ) );
8282 }
8383 return "";
8484 }

Status & tagging log