Backward compatibility of #334 for 1.x
Hi
Some time ago, I've created the pull request: #334 which was merged to master branch. The problem is, the most used version is 1.x. So we need to fix it for this version too. Cherry-picking wasn't a option, because the #334 version only works for PHP 7.2+.
So my approach is based on the new PHP_OS_FAMILY (PHP 7.2+) mixed with older PHP_OS detection and the help of this issue: https://github.com/sebastianbergmann/environment/issues/21
@cweagans What do you think?
manual of patch:
https://man.netbsd.org/patch.1
https://man.openbsd.org/patch.1
https://www.freebsd.org/cgi/man.cgi?patch(1)
Closes #182 Closes #184
@cweagans any thoughts on this PR?
I tested this on FreeBSD and it didn't actually work for me - it seems to run patch '-p4' '--posix --batch' -d 'web/core' < '/tmp//6252865cb0bbf.patch'
which results in patch: unrecognized option `--posix --batch'
I guess because escapeshellarg(), which adds single quotes, is run on the options as if they were one argument.
The approach in #402 would work here too - building an array of options which can be escaped individually.
@mfb Yeah could be, but actually you're talking about a different issue. Without #334 or this #396 it wouldn't even work on FreeBSD. I'll have a look on the changes in #402 and see if I can update this PR to the 1.X branch
Well, the point is that #334 and this PR #396 don't yet work on FreeBSD, but I think we're getting close - #402 is now able to get the master branch working on FreeBSD, and we need similar code for this PR on the 1.x branch.
@mfb Ok, I see the issue. I'll wait until #402 is merged and will then adjust the backport
#447 has explicit support for BSD patch. Please take a look at src/Patcher/* - let me know if that works for you.
hmm @cweagans...in this PR the goal was to backport the BSD Patch feature to 1.X but #447 is only for 2.X