convoworks-core icon indicating copy to clipboard operation
convoworks-core copied to clipboard

Expression parser is not able to handle associative arrays inside expression

Open tolecar opened this issue 5 years ago • 0 comments

While evaluating strings, EvalContext:_extractExpressions() has to parse out all expressions which are defined with ${}. As the PHP associative array syntax uses curly brackets too, current parsing mechanism is not able to handle it right,

Example:

indexed array is OK ${count(['a', 'b'])}
associative array will fail ${count({'a'=>'option', 'b'=>'other option'})}

Requirements:

  • add unit test which will test associative array parsing (and will fail currently)
  • improve parsing to support use of associative arrays

Side note:

It seems like this functionality might be migrated to the https://github.com/zef-dev/zef-expression-language library

tolecar avatar Dec 08 '20 22:12 tolecar