Avoid DEMPTY leak

As shown in the coverage reports [0], some empty operand logging lines are covered, but no test should have empty operands. I see one of the cause is skipOverBraces keeping $result as is, even if DEMPTY, so turn it into a DUNDEFINED.

[0] - https://doc.wikimedia.org/cover-extensions/AbuseFilter/includes/parser/AbuseFilterParser.php.html

Change-Id: I7831f3ed9f7c0656e0e8f77ded049c20eca682ba
This commit is contained in:
Daimona Eaytoy 2019-08-04 18:23:56 +00:00
parent 879ff59fe2
commit f977e858ab

View file

@ -791,6 +791,7 @@ class AbuseFilterParser {
protected function doLevelBraces( &$result ) {
if ( $this->mCur->type === AFPToken::TBRACE && $this->mCur->value === '(' ) {
if ( $this->mShortCircuit ) {
$result = new AFPData( AFPData::DEMPTY );
$this->skipOverBraces();
} else {
$this->doLevelSemicolon( $result );
@ -830,6 +831,7 @@ class AbuseFilterParser {
}
if ( $this->mShortCircuit ) {
$result = new AFPData( AFPData::DEMPTY );
$this->skipOverBraces();
$this->move();