Index: trunk/phase3/includes/api/ApiQueryAllUsers.php |
— | — | @@ -234,11 +234,13 @@ |
235 | 235 | ApiBase::dieDebug( __METHOD__, |
236 | 236 | 'MediaWiki configuration error: the database contains more user groups than known to User::getAllGroups() function' ); |
237 | 237 | } |
| 238 | + |
| 239 | + $lastUserObj = User::newFromName( $lastUser ); |
238 | 240 | |
239 | 241 | // Add user's group info |
240 | 242 | if ( $fld_groups ) { |
241 | | - if ( !isset( $lastUserData['groups'] ) ) { |
242 | | - $lastUserData['groups'] = ApiQueryUsers::getAutoGroups( User::newFromName( $lastUser ) ); |
| 243 | + if ( !isset( $lastUserData['groups'] ) && $lastUserObj ) { |
| 244 | + $lastUserData['groups'] = ApiQueryUsers::getAutoGroups( $lastUserObj ); |
243 | 245 | } |
244 | 246 | |
245 | 247 | if ( !is_null( $row->ug_group2 ) ) { |
— | — | @@ -247,13 +249,13 @@ |
248 | 250 | $result->setIndexedTagName( $lastUserData['groups'], 'g' ); |
249 | 251 | } |
250 | 252 | |
251 | | - if ( $fld_implicitgroups && !isset( $lastUserData['implicitgroups'] ) ) { |
252 | | - $lastUserData['implicitgroups'] = ApiQueryUsers::getAutoGroups( User::newFromName( $lastUser ) ); |
| 253 | + if ( $fld_implicitgroups && !isset( $lastUserData['implicitgroups'] ) && $lastUserObj ) { |
| 254 | + $lastUserData['implicitgroups'] = ApiQueryUsers::getAutoGroups( $lastUserObj ); |
253 | 255 | $result->setIndexedTagName( $lastUserData['implicitgroups'], 'g' ); |
254 | 256 | } |
255 | 257 | if ( $fld_rights ) { |
256 | | - if ( !isset( $lastUserData['rights'] ) ) { |
257 | | - $lastUserData['rights'] = User::getGroupPermissions( User::newFromName( $lastUser )->getAutomaticGroups() ); |
| 258 | + if ( !isset( $lastUserData['rights'] ) && $lastUserObj ) { |
| 259 | + $lastUserData['rights'] = User::getGroupPermissions( $lastUserObj->getAutomaticGroups() ); |
258 | 260 | } |
259 | 261 | if ( !is_null( $row->ug_group2 ) ) { |
260 | 262 | $lastUserData['rights'] = array_unique( array_merge( $lastUserData['rights'], |