r87627 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87626‎ | r87627 | r87628 >
Date:13:05, 7 May 2011
Author:happy-melon
Status:ok
Tags:
Comment:
(bug 28797) Fix ApiBase::parseMsg() to properly handle nested error arrays.
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiBase.php
@@ -1119,6 +1119,14 @@
11201120 */
11211121 public function parseMsg( $error ) {
11221122 $key = array_shift( $error );
 1123+
 1124+ // Check whether the error array was nested
 1125+ // array( array( <code>, <params> ), array( <another_code>, <params> ) )
 1126+ if( is_array( $key ) ){
 1127+ $error = $key;
 1128+ $key = array_shift( $error );
 1129+ }
 1130+
11231131 if ( isset( self::$messageMap[$key] ) ) {
11241132 return array( 'code' =>
11251133 wfMsgReplaceArgs( self::$messageMap[$key]['code'], $error ),
@@ -1126,6 +1134,7 @@
11271135 wfMsgReplaceArgs( self::$messageMap[$key]['info'], $error )
11281136 );
11291137 }
 1138+
11301139 // If the key isn't present, throw an "unknown error"
11311140 return $this->parseMsg( array( 'unknownerror', $key ) );
11321141 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r92328REL1_18 MFT r79056, r80612, r81499, r87627, r87628, r87630, r87998, r88134, r...reedy22:46, 15 July 2011

Status & tagging log