X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiUserrights.php;h=e251fe6943011de88ba6163cb725c408102906dd;hb=4ec93f15d6146d5881c7754ce7d3202d758b326d;hp=56c2c84cc8ac32c71eb5dac1949a3c11fab051b0;hpb=e929c716317eae338196d7f35a98550de769b224;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiUserrights.php b/includes/api/ApiUserrights.php index 56c2c84cc8..e251fe6943 100644 --- a/includes/api/ApiUserrights.php +++ b/includes/api/ApiUserrights.php @@ -100,7 +100,7 @@ class ApiUserrights extends ApiBase { $tags = $params['tags']; // Check if user can add tags - if ( !is_null( $tags ) ) { + if ( $tags !== null ) { $ableToTag = ChangeTags::canAddTagsAccompanyingChange( $tags, $pUser ); if ( !$ableToTag->isOK() ) { $this->dieStatus( $ableToTag ); @@ -112,8 +112,9 @@ class ApiUserrights extends ApiBase { $r['user'] = $user->getName(); $r['userid'] = $user->getId(); list( $r['added'], $r['removed'] ) = $form->doSaveUserGroups( + // Don't pass null to doSaveUserGroups() for array params, cast to empty array $user, (array)$add, (array)$params['remove'], - $params['reason'], $tags, $groupExpiries + $params['reason'], (array)$tags, $groupExpiries ); $result = $this->getResult(); @@ -133,7 +134,7 @@ class ApiUserrights extends ApiBase { $this->requireOnlyOneParameter( $params, 'user', 'userid' ); - $user = isset( $params['user'] ) ? $params['user'] : '#' . $params['userid']; + $user = $params['user'] ?? '#' . $params['userid']; $form = $this->getUserRightsPage(); $form->setContext( $this->getContext() );