phingofficial/phing

Property File Loading Order and Variable Reference Issue

Maretius opened this issue · 1 comments

Describe the bug
I have encountered an issue in Phing related to the loading order of property files and variable references. The problem occurs when multiple property files are loaded, and there is a reference to a variable defined in a later file.

I have two property files, one.env and two.env with the following contents:

one.env:

test=foo

two.env:

test=bar
test2=${test}

When loading these property files using the task in Phing, the variable "test2" is not being correctly overridden. The expected behavior is that "test2" should have the value "bar" since it is being overridden in two.env.

Steps To Reproduce

Use the following <property> tasks in the Phing build file:

<property file="one.env" override="true"/>
<property file="two.env" override="true"/>

Use <echoproperties/> to output the property values.

Expected behavior

Buildfile: ./build.xml
 [property] Loading ./one.env
 [property] Loading ./two.env

build-tools > test:
#
#Phing properties
#
test=bar
test2=bar

Screenshots / terminal output

Buildfile: ./build.xml
 [property] Loading ./one.env
 [property] Loading ./two.env

build-tools > test:
#
#Phing properties
#
test=bar
test2=foo

Additional context
Phing Version: Phing 3.0.0-RC6
Operating System: Debian GNU/Linux 12 (bookworm) in WSL2 (Windows 10 Enterprise 22H2)

Good catch. When resolving newly loaded properties, we first check project properties before we check the new properties. That order should be reversed.