r62814 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62813‎ | r62814 | r62815 >
Date:07:02, 22 February 2010
Author:tstarling
Status:ok
Tags:
Comment:
Fixes for r62505:
* In MagicWordArray::matchStartAndRemove(), fixed the case where the length of localised synonym is not precisely the length of the magic word ID plus one
* Fixed the case where matchStartAndRemove() removes the entire string, send empty string not false
* Fix brace style
Modified paths:
  • /trunk/phase3/includes/MagicWord.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -2793,8 +2793,7 @@
27942794
27952795 # Possibilities for substMatch: "subst", "safesubst" or FALSE
27962796 # Decide whether to expand template or keep wikitext as-is.
2797 - if ( $this->ot['wiki'] )
2798 - {
 2797+ if ( $this->ot['wiki'] ) {
27992798 if ( $substMatch === false ) {
28002799 $literal = true; # literal when in PST with no prefix
28012800 } else {
Index: trunk/phase3/includes/MagicWord.php
@@ -719,11 +719,14 @@
720720 if ( $regex === '' ) {
721721 continue;
722722 }
723 - preg_match( $regex, $text, $match );
724 - if ( $match ) {
725 - list( $found, $param ) = $this->parseMatch( $match );
726 - $text = substr( $text, strlen( $found ) + 1 );
727 - return $found;
 723+ if ( preg_match( $regex, $text, $m ) ) {
 724+ list( $id, $param ) = $this->parseMatch( $m );
 725+ if ( strlen( $m[0] ) >= strlen( $text ) ) {
 726+ $text = '';
 727+ } else {
 728+ $text = substr( $text, strlen( $m[0] ) );
 729+ }
 730+ return $id;
728731 }
729732 }
730733 return false;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r62505clean r61713 (and r61710) per code reviewconrad09:34, 15 February 2010

Status & tagging log