Page MenuHomePhabricator

"&" is not commutative when an operand is undefined
Open, Needs TriagePublic

Description

See here (the table and the comment below it)

Event Timeline

AFPData::boolOp discards the DUNDEFINED value in both operands. I think it should do like other methods, and return DUNDEFINED if either of the operands is undefined, instead. However, I should first understand why I didn't do it at first. We should also add a test like

$this->assertEquals( AFPData::DUNDEFINED, $parser->intEval( $code ) )

where $code comes from a DataProvider with the examples taken from the table on enwiki.

Oh, from a quick glance: it doesn't return DUNDEFINED because this way dundefined | true is also true (and we want this). So it should return DUNDEFINED only if either operand is undefined, AND the operator is &. I don't know whether that should be handled by boolOp, or by the parser.