From fdaf6030649d726295a8f542184c07add743fe1f Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Mon, 19 May 2008 21:43:52 +0000 Subject: [PATCH] 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). --- includes/api/ApiQueryUserInfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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'])) { -- 2.20.1