diff --git a/AbuseFilter.parser.new.php b/AbuseFilter.parser.new.php index 82afcbe3b..af7911a34 100644 --- a/AbuseFilter.parser.new.php +++ b/AbuseFilter.parser.new.php @@ -143,7 +143,7 @@ class AFPTreeParser { // Current token handled by the parser and its position. public $mCur, $mPos; - const CACHE_VERSION = 1; + const CACHE_VERSION = 2; /** * Create a new instance @@ -415,14 +415,14 @@ class AFPTreeParser { protected function doLevelBoolOps() { $leftOperand = $this->doLevelCompares(); $ops = [ '&', '|', '^' ]; - if ( $this->mCur->type == AFPToken::TOP && in_array( $this->mCur->value, $ops ) ) { + while ( $this->mCur->type == AFPToken::TOP && in_array( $this->mCur->value, $ops ) ) { $op = $this->mCur->value; $position = $this->mPos; $this->move(); - $rightOperand = $this->doLevelBoolOps(); + $rightOperand = $this->doLevelCompares(); - return new AFPTreeNode( + $leftOperand = new AFPTreeNode( AFPTreeNode::LOGIC, [ $op, $leftOperand, $rightOperand ], $position diff --git a/tests/parserTests/bool-assoc.r b/tests/parserTests/bool-assoc.r new file mode 100644 index 000000000..4736e0800 --- /dev/null +++ b/tests/parserTests/bool-assoc.r @@ -0,0 +1 @@ +MATCH diff --git a/tests/parserTests/bool-assoc.t b/tests/parserTests/bool-assoc.t new file mode 100644 index 000000000..4b236bd21 --- /dev/null +++ b/tests/parserTests/bool-assoc.t @@ -0,0 +1 @@ +!(true | false & false)