r64454 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64453‎ | r64454 | r64455 >
Date:19:50, 31 March 2010
Author:mah
Status:resolved (Comments)
Tags:
Comment:
Get rid of E_STRICT message
Modified paths:
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiBase.php
@@ -475,8 +475,10 @@
476476 $params = $this->getFinalParams();
477477 $results = array();
478478
479 - foreach ( $params as $paramName => $paramSettings ) {
480 - $results[$paramName] = $this->getParameterFromSettings( $paramName, $paramSettings, $parseLimit );
 479+ if($params) { /* getFinalParams() can return false */
 480+ foreach ( $params as $paramName => $paramSettings ) {
 481+ $results[$paramName] = $this->getParameterFromSettings( $paramName, $paramSettings, $parseLimit );
 482+ }
481483 }
482484
483485 return $results;

Follow-up revisions

RevisionCommit summaryAuthorDate
r64465follow up r64454 — change comment stylemah00:35, 1 April 2010
r653131.16wmf4: Revert r64778, merge the almost equivalent but better r64454 from t...catrope13:58, 20 April 2010
r65319Merge r64454 from trunkdemon14:19, 20 April 2010

Comments

#Comment by Happy-melon (talk | contribs)   20:02, 31 March 2010

Check spacing and comment format (use # or // for inline comments).

#Comment by MarkAHershberger (talk | contribs)   00:36, 1 April 2010

see r64465

#Comment by Catrope (talk | contribs)   20:24, 31 March 2010

An equally valid way of fixing this is foreach ( (array)$params as ...

#Comment by Tim Starling (talk | contribs)   13:52, 20 April 2010

It's not quite the same thing:

> var_dump((array)false)
array(1) {
  [0]=>
  bool(false)
}

Your way will create a parameter called "0", Mark's version won't.

Status & tagging log