Skip to content

Expression Engine: Replace == by = #1

@NITFALL

Description

@NITFALL

In the ExpressionEngine in line 728 there is a piece of code which tries to replace "==" by "=".

myStr = myStr.replace(new RegExp('=='), '=');

This only replaces the first occurrence of all available "==".
So a more complex expression like
(a > 3 && b == 'abc') || (partNumber == 'xyz' || (properties.cellType == 'Battery' && (dut.id <= 1 || dut.p == 3)))

fails to evaluate because only b == 'abc' will be replaced by b = 'abc'.

If I change the code to
myStr = myStr.replace(new RegExp('==', 'g'), '=');
all occurrences get replaced and evaluation of the given expression passes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions