Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Expression language]Trying to evaluate expression with a not existing variable in the array  #21691

Closed
@hab92

Description

@hab92
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Symfony version 2.8

I'm trying to evaluate an expression with an array not containing all variables of the expression.

When i evaluate the expression with my array, the evaluation return a exception :

Variable XXXX is not valid around position 1.

My problem is when i have a expression like

( ( var1 != 2 ) or ( var2 != 2 ) ),

and an array

array(
        'var1' => 3,
) 

this evaluation throw an exception. Should we not return a boolean instead of an exception ?

For exemple if we have the expression :

(a and b and c) or (d and e and f)

and e does not exist in the array, the expression (d and e and f) return false and not an exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExpressionLanguageHelp wantedIssues and PRs which are looking for volunteers to complete them.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions