r50097 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50096‎ | r50097 | r50098 >
Date:06:35, 1 May 2009
Author:tstarling
Status:deferred
Tags:
Comment:
* Backported r48813, r48819: fatal errors in the API
Modified paths:
  • /branches/REL1_15/phase3/includes/api (modified) (history)
  • /branches/REL1_15/phase3/includes/api/ApiQueryCategories.php (modified) (history)
  • /branches/REL1_15/phase3/includes/api/ApiQueryImageInfo.php (modified) (history)

Diff [purge]

Index: branches/REL1_15/phase3/includes/api/ApiQueryImageInfo.php
@@ -224,14 +224,16 @@
225225 public static function processMetaData($metadata, $result)
226226 {
227227 $retval = array();
228 - foreach($metadata as $key => $value)
229 - {
230 - $r = array('name' => $key);
231 - if(is_array($value))
232 - $r['value'] = self::processMetaData($value, $result);
233 - else
234 - $r['value'] = $value;
235 - $retval[] = $r;
 228+ if ( is_array( $metadata ) ) {
 229+ foreach($metadata as $key => $value)
 230+ {
 231+ $r = array('name' => $key);
 232+ if(is_array($value))
 233+ $r['value'] = self::processMetaData($value, $result);
 234+ else
 235+ $r['value'] = $value;
 236+ $retval[] = $r;
 237+ }
236238 }
237239 $result->setIndexedTagName($retval, 'metadata');
238240 return $retval;
Index: branches/REL1_15/phase3/includes/api/ApiQueryCategories.php
@@ -87,7 +87,7 @@
8888 foreach($params['categories'] as $cat)
8989 {
9090 $title = Title::newFromText($cat);
91 - if($title->getNamespace() != NS_CATEGORY)
 91+ if(!$title || $title->getNamespace() != NS_CATEGORY)
9292 $this->setWarning("``$cat'' is not a category");
9393 else
9494 $cats[] = $title->getDBkey();
@@ -239,4 +239,4 @@
240240 public function getVersion() {
241241 return __CLASS__ . ': $Id$';
242242 }
243 -}
\ No newline at end of file
 243+}
Property changes on: branches/REL1_15/phase3/includes/api
___________________________________________________________________
Name: svn:mergeinfo
244244 + /trunk/phase3/includes/api:48813-48814,48819,48909,49051,49068,49086,49682,49775

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r48813Check for title validity in ApiQueryCategorieswerdna13:43, 25 March 2009
r48819Fix fatals in ApiQueryImageInfo.php where no metadata existswerdna13:59, 25 March 2009

Status & tagging log