Open lpd-au opened 4 months ago
I've had a look into this. Initially I tried changing exec
and passthru
to use proc_open
, where we can pass in the arguments individually rather than have a shell interpret a string, however that change is quite large and affects multiple other classes. It makes things a lot more robust and the "output" and "error" features are much cleaner this way, but I'm afraid that the change is too large for a patch version number. For reference, I have uploaded my current snapshot to https://github.com/phingofficial/phing/compare/main...fredden:phing:feature/gh-issue-1839 - but this is far from ready as several tests are still failing.
@mrook I can see that you've tagged this as a good first issue. Please can you provide some guidance on what you had in mind to fix this?
I have also been unsuccessfully trying to find a solution for this. We used to have several constructs such as the following:
<exec command="... -e '${exclude}'" />
It can be that the exclude property evaluates to an empty string, in which case -e ''
would be the expected command line while simply omitting the empty string results in an error.
I have tried several approaches:
<arg value="-e"/><arg value="${exclude}"/>
outputs -e
<arg line="-e '${exclude}'"/>
outputs -e
<arg line='-e "${exclude}"'/>
outputs -e
<arg value="-e"/><arg value="'${exclude}'"/>
outputs -e ''\'''\'''
<arg value="-e"/><arg value='"${exclude}"'/>
outputs -e ""
but would output -e '"property"'
if not empty
Describe the bug With Phing 2 it was possible to do this:
This produced:
The documentation says it should still be possible with Phing 3:
However, this produces a literal
""
with any value ofescape
(including none); I cannot find a combination of attributes that produces the same behaviour as before.Steps To Reproduce
Expected behavior
Screenshots / terminal output
Additional context Replacing the inline php with a file still outputs a non-zero length string: