Skip to content

Replacetokens treating values as boolean #1719

@mpeter-fv

Description

@mpeter-fv

Describe the bug
In the latest version 3.0.0-RC5, replacing tokens with the value 1, results in them being replaced with true instead.

Steps To Reproduce
build.xml

<?xml version="1.0" encoding="UTF-8"?>
<project name="Test" default="test">
    <target name="test">
        <copy file="test.reference.json" tofile="test.json" overwrite="true">
            <filterchain>
                <replacetokens begintoken="%" endtoken="%">
                    <token key="TEST_TOKEN" value="1"/>
                </replacetokens>
            </filterchain>
        </copy>
    </target>
</project>

test.reference.json

{
  "test": "%TEST_TOKEN%"
}

Command executed:

/usr/bin/php7.4 ./phing-3.0.0-RC5.phar -f build.xml

Result:

cat test.json
{
  "test": "true"
}

Expected behavior
Using a <token> with value="1" should be treated verbatim.

Additional context
This is working fine with Phing 2 or when the value is greater than 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions