php-rule-parser icon indicating copy to clipboard operation
php-rule-parser copied to clipboard

Fatal error with Bool variables and ||

Open stavultras opened this issue 3 years ago • 0 comments

There is a PHP fatal error when === false/true isn't added after "boolean" functions.

Version: 0.7.1 PHP version: 8.1 How to replicate:

$engine_rule = new Rule('VAR.startsWith("xXx") || VAR.startsWith("xXx") === false', ['VAR' => 'blablabla']);
$engine_rule->isTrue();

Expected result: Validation error like "invalid token || blablabla" until === false/true is added. Actual result: nicoSWD\Rule\Expression\ExpressionFactory::createFromOperator(): Argument #1 ($operator) must be of type nicoSWD\Rule\TokenStream\Token\BaseToken, null given, called in libs\php-rule-parser\src\Parser\Parser.php on line 61

Thank you.

stavultras avatar Oct 06 '22 16:10 stavultras