From 63601400e476c6cf43d985f3e7b9864681695ed4 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 18 Jan 2013 16:46:04 +0100 Subject: Update to MediaWiki 1.20.2 this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024 --- includes/MagicWord.php | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) (limited to 'includes/MagicWord.php') diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 1ba46701..42791f57 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -1,15 +1,30 @@ getMagic( $this ); if ( !$this->mSynonyms ) { $this->mSynonyms = array( 'dkjsagfjsgashfajsh' ); - #throw new MWException( "Error: invalid magic word '$id'" ); - wfDebugLog( 'exception', "Error: invalid magic word '$id'\n" ); + throw new MWException( "Error: invalid magic word '$id'" ); + #wfDebugLog( 'exception', "Error: invalid magic word '$id'\n" ); } wfProfileOut( __METHOD__ ); } @@ -628,6 +646,9 @@ class MagicWordArray { var $baseRegex, $regex; var $matches; + /** + * @param $names array + */ function __construct( $names = array() ) { $this->names = $names; } @@ -755,6 +776,14 @@ class MagicWordArray { return $newRegex; } + /** + * @since 1.20 + * @return array + */ + public function getNames() { + return $this->names; + } + /** * Parse a match array from preg_match * Returns array(magic word ID, parameter value) @@ -762,6 +791,7 @@ class MagicWordArray { * * @param $m array * + * @throws MWException * @return array */ function parseMatch( $m ) { @@ -798,7 +828,7 @@ class MagicWordArray { $regexes = $this->getVariableStartToEndRegex(); foreach ( $regexes as $regex ) { if ( $regex !== '' ) { - $m = false; + $m = array(); if ( preg_match( $regex, $text, $m ) ) { return $this->parseMatch( $m ); } @@ -813,7 +843,7 @@ class MagicWordArray { * * @param $text string * - * @return string|false + * @return string|bool False on failure */ public function matchStartToEnd( $text ) { $hash = $this->getHash(); @@ -861,7 +891,7 @@ class MagicWordArray { * * @param $text string * - * @return int|false + * @return int|bool False on failure */ public function matchStartAndRemove( &$text ) { $regexes = $this->getRegexStart(); -- cgit v1.2.2