r12499 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r12498‎ | r12499 | r12500 >
Date:04:25, 8 January 2006
Author:avar
Status:old
Tags:
Comment:
* Fixed bug, $this->mBaseRegex would contain an invalid regular expression if
the supplied magic word synonyms contained /, of course none of them do, but
hey;)
Modified paths:
  • /trunk/phase3/includes/MagicWord.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/MagicWord.php
@@ -173,8 +173,13 @@
174174 # This was used for matching "$1" variables, but different uses of the feature will have
175175 # different restrictions, which should be checked *after* the MagicWord has been matched,
176176 # not here. - IMSoP
177 - $escSyn = array_map( 'preg_quote', $this->mSynonyms );
 177+
 178+ $escSyn = array();
 179+ foreach ( $this->mSynonyms as $synonym )
 180+ // In case a magic word contains /, like that's going to happen;)
 181+ $escSyn[] = preg_quote( $synonym, '/' );
178182 $this->mBaseRegex = implode( '|', $escSyn );
 183+
179184 $case = $this->mCaseSensitive ? '' : 'i';
180185 $this->mRegex = "/{$this->mBaseRegex}/{$case}";
181186 $this->mRegexStart = "/^(?:{$this->mBaseRegex})/{$case}";

Status & tagging log