Special:UserRights: Fix handling of empty conflict check value
authorGergő Tisza <tgr.huwiki@gmail.com>
Mon, 7 Jan 2019 02:03:07 +0000 (18:03 -0800)
committerGergő Tisza <tgr.huwiki@gmail.com>
Mon, 7 Jan 2019 02:03:07 +0000 (18:03 -0800)
Bug: T164211
Change-Id: I6b710a25e9be29497846fafe39c916d480989a96

includes/specials/SpecialUserrights.php

index 0f9ded3..94b8184 100644 (file)
@@ -170,10 +170,11 @@ class UserrightsPage extends SpecialPage {
                                $targetUser->clearInstanceCache(); // T40989
                        }
 
-                       $checkValue = explode( ',', $request->getVal( 'conflictcheck-originalgroups' ) );
+                       $conflictCheck = $request->getVal( 'conflictcheck-originalgroups' );
+                       $conflictCheck = ( $conflictCheck === '' ) ? [] : explode( ',', $conflictCheck );
                        $userGroups = $targetUser->getGroups();
 
-                       if ( $userGroups !== $checkValue ) {
+                       if ( $userGroups !== $conflictCheck ) {
                                $out->addWikiMsg( 'userrights-conflict' );
                        } else {
                                $status = $this->saveUserGroups(