r48819 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48818‎ | r48819 | r48820 >
Date:13:59, 25 March 2009
Author:werdna
Status:ok
Tags:
Comment:
Fix fatals in ApiQueryImageInfo.php where no metadata exists
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryImageInfo.php (modified) (history)

Diff [purge]

Index: trunk/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;

Follow-up revisions

RevisionCommit summaryAuthorDate
r50097* Backported r48813, r48819: fatal errors in the APItstarling06:35, 1 May 2009

Status & tagging log