From: Bryan Tong Minh Date: Mon, 19 May 2008 21:43:52 +0000 (+0000) Subject: Force indices of groups and rights array to be in order so that the JSON formatter... X-Git-Tag: 1.31.0-rc.0~47536 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=fdaf6030649d726295a8f542184c07add743fe1f;p=lhc%2Fweb%2Fwiklou.git Force indices of groups and rights array to be in order so that the JSON formatter recognizes it as a list instead of a dict in case for some reason rights or groups are removed somewhere in between (as done for sysops on testwiki). --- diff --git a/includes/api/ApiQueryUserInfo.php b/includes/api/ApiQueryUserInfo.php index 7af4d50a6c..d676003f56 100644 --- a/includes/api/ApiQueryUserInfo.php +++ b/includes/api/ApiQueryUserInfo.php @@ -72,11 +72,11 @@ class ApiQueryUserInfo extends ApiQueryBase { $vals['messages'] = ''; } if (isset($this->prop['groups'])) { - $vals['groups'] = $wgUser->getGroups(); + $vals['groups'] = array_values( $wgUser->getGroups() ); $result->setIndexedTagName($vals['groups'], 'g'); // even if empty } if (isset($this->prop['rights'])) { - $vals['rights'] = $wgUser->getRights(); + $vals['rights'] = array_values( $wgUser->getRights() ); $result->setIndexedTagName($vals['rights'], 'r'); // even if empty } if (isset($this->prop['options'])) {