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:
Daimona Eaytoy 2019-10-30 12:28:53 +01:00
parent 357dcdce5c
commit d5ab147dcf
2 changed files with 5 additions and 1 deletions

View file

@ -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;

View file

@ -0,0 +1,3 @@
/* CachingParser's intEval used to return AFPTreeNode for this - T236870 */
a := [];
a[] := 2;