phingofficial / phingofficial/phing

Change in behavior from v2 to v3 when overriding property for phingcall

Open
#1,963 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.2k
Forks
319
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
We recently migrated from Phing 2 to Phing 3.

We encountered a change in behavior when overriding properties for phingcalls, that we could not find in the changelog, the upgrade guide or the task documentation. But maybe we are simply missing something.

In Phing 2 we were able to define a property via CLI that was used in a phing target and then override this property for a specific <phingcall> to that target. In Phing 3 this does not work anymore and it causes trouble for our CI pipelines. So far I was not able to find a solution to that issue.

Steps To Reproduce
Without providing our real world example that is a lot larger, this example covers the issue we are having:

<?xml version="1.0" encoding="UTF-8"?>
<project name="Some project" default="something">

    <target name="something">
        <phingcall target="something_else" />
        <phingcall target="something_else">
            <property name="SOME_PROPERTY" value="${ANOTHER_PROPERTY}" override="true" />
        </phingcall>
    </target>

    <target name="something_else">
        <echo message="${SOME_PROPERTY}" />
    </target>
</project>

We are calling: phing -DSOME_PROPERTY=A -DANOTHER_PROPERTY=B

Expected behavior
The output I expect, is what we are getting with Phing 2:

Some project > something:
Some project > something_else:
     [echo] A
Some project > something_else:
     [echo] B
BUILD FINISHED

Screenshots / terminal output
With Phing 3 we are getting the following though:

Some project > something:
Some project > something_else:
     [echo] A
Some project > something_else:
     [echo] A
BUILD FINISHED

So the override of the property for that specific call simply does not work.

Additional context
If I define SOME_PROPERTY not via CLI, but instead inside the phing project, it works. Like the following:

<project name="Some project" default="something">

    <property name="SOME_PROPERTY" value="A" />

    <target name="something">
        <phingcall target="something_else" />
        <phingcall target="something_else">
            <property name="SOME_PROPERTY" value="${ANOTHER_PROPERTY}" override="true" />
        </phingcall>
    </target>

We are running Phing 3.1.0 in PHP 8.3 as well as 8.4 (depending on the project)

Any help would be appreciated. If this is not a bug but intended behavior, I would be grateful for any pointers as to how we might be able to resolve this.

Thank you for your help

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the task implementation and reproduce the behavior with the XML example and CLI properties shown in the issue. Compare the Phing 2 and Phing 3 handling of the call-level override; done means the second call outputs B while the first still outputs A, or the intended behavior is documented with a workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.