diff --git a/includes/Parser/FilterEvaluator.php b/includes/Parser/FilterEvaluator.php index a7724caba..7efb0ec09 100644 --- a/includes/Parser/FilterEvaluator.php +++ b/includes/Parser/FilterEvaluator.php @@ -454,7 +454,13 @@ class FilterEvaluator { */ public function getUsedVars( $filter ) { $this->resetState(); - $this->evaluateExpression( $filter ); + $cachedAllowShort = $this->mAllowShort; + try { + $this->mAllowShort = false; + $this->evaluateExpression( $filter ); + } finally { + $this->mAllowShort = $cachedAllowShort; + } return array_unique( $this->usedVars ); } diff --git a/tests/phpunit/unit/Parser/ParserTest.php b/tests/phpunit/unit/Parser/ParserTest.php index 1adaf5cbb..f7ed30e99 100644 --- a/tests/phpunit/unit/Parser/ParserTest.php +++ b/tests/phpunit/unit/Parser/ParserTest.php @@ -1170,7 +1170,13 @@ class ParserTest extends ParserTestCase { $parser = $this->getParser(); /** @var FilterEvaluator $wrapper */ $wrapper = TestingAccessWrapper::newFromObject( $parser ); - $this->assertSame( [ 'user_name' ], $wrapper->getUsedVars( 'ip_in_range( user_name, "1.2.3.4" )' ) ); - $this->assertSame( [ 'user_name' ], $wrapper->getUsedVars( 'ip_in_range( USER_NAME, "1.2.3.4" )' ) ); + $this->assertSame( + [ 'action', 'user_name' ], + $wrapper->getUsedVars( 'action = "edit" & ip_in_range( user_name, "1.2.3.4" )' ) + ); + $this->assertSame( + [ 'action', 'user_name' ], + $wrapper->getUsedVars( 'action = "edit" & ip_in_range( USER_NAME, "1.2.3.4" )' ) + ); } }