mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 21:53:35 +00:00
Fix AbuseFilterCachingParser violating return type constraint
This is identical to I8a3c31e7385283d95b4712d457784016239a0b3b, except for the array append case. Bug: T236870 Change-Id: Iac033ba467232f6ff110d575920e968759ce0e15
This commit is contained in:
parent
357dcdce5c
commit
d5ab147dcf
|
@ -321,6 +321,7 @@ class AbuseFilterCachingParser extends AbuseFilterParser {
|
|||
}
|
||||
|
||||
$array = $this->getVarValue( $varName );
|
||||
$value = $this->evalNode( $value );
|
||||
if ( $array->getType() !== AFPData::DUNDEFINED ) {
|
||||
// If it's a DUNDEFINED, leave it as is
|
||||
if ( $array->getType() !== AFPData::DARRAY ) {
|
||||
|
@ -328,7 +329,7 @@ class AbuseFilterCachingParser extends AbuseFilterParser {
|
|||
}
|
||||
|
||||
$array = $array->toArray();
|
||||
$array[] = $this->evalNode( $value );
|
||||
$array[] = $value;
|
||||
$this->setUserVariable( $varName, new AFPData( AFPData::DARRAY, $array ) );
|
||||
}
|
||||
return $value;
|
||||
|
|
3
tests/parserTests/array-statements3.t
Normal file
3
tests/parserTests/array-statements3.t
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* CachingParser's intEval used to return AFPTreeNode for this - T236870 */
|
||||
a := [];
|
||||
a[] := 2;
|
Loading…
Reference in a new issue