Page MenuHomePhabricator

misused of array_intersect lead to wrong switch
Closed, DeclinedPublic

Description

in extensions/GraphViz/includes/GraphViz.php, getUser function,

if ( array_intersect($rights, $requiredRights) == $requiredRights ) {
                 return $wgUser;
 }

the result is not expected, because of the order problem!

if ( array_intersect($requiredRights,  $rights ) == $requiredRights ) { 
                  return $wgUser;
 }

temporally fix the problem

PHP: array_intersect - Manual

array_intersect() returns an array containing all the values of array1 that are present in all the arguments. Note that keys are preserved.

产品版本
MediaWiki1.30.0
PHP5.6.36 (fpm-fcgi)
MySQL5.7.22
ICU50.1.2

Details

Event Timeline

Thanks for taking a look at the code!

You are very welcome to use developer access to submit the proposed code changes as a Git branch directly into Gerrit which makes it easier to review them quickly and provide feedback.
If you don't want to set up Git/Gerrit, you can also use the Gerrit Patch Uploader. Thanks again!

@Samwilson Perhaps you would like to have a look and a go on this? :)

Change 488597 had a related patch set uploaded (by Samwilson; owner: Samwilson):
[mediawiki/extensions/GraphViz@master] Fix bug with checking user's rights

https://gerrit.wikimedia.org/r/488597