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

Skip to content

[ExpressionLanguage] Trailing spaces in expressions lead to 'Uninitialized string offset: X' warnings #9606

Closed
@rolebi

Description

@rolebi

Using Symfony\Component\ExpressionLanguage::tokenize() with ' ' (only spaces) or any expression with trailing spaces like '1 + 1 ' will produce an Uninitialized string offset: X php warning due to the way spaces are ignored:

// Symfony\Component\ExpressionLanguage::tokenize() lines 39 to 41

while (' ' == $expression[$cursor]) {
    ++$cursor;
}

If EOF_TYPE Token position is not a problem, a rtrim on passed expression will do the job.

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