Skip to content

[ExpressionLanguage] arithmetic and concatenation operators precedence #46344

Closed
@leongrdic

Description

@leongrdic

Symfony version(s) affected

Expression Language 6.0.8

Description

I wanted to ask if this is desired behavior:

"1 + 2 ~ 5 + 3" results in 29

I believe most people would expect the result to be "38", or in other words, the precedence to be: (1+2)~(5+3), especially when doing something like this: "index: " ~ index+1

I also think it's worth noting that in PHP the same expression (1 + 2 . 5 + 3) results in 38

How to reproduce

<?php

$sel = new Symfony\Component\ExpressionLanguage\ExpressionLanguage();

$result = $sel->evaluate('1 + 2 ~ 5 + 3');
// $result is 29

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions