Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RulesetTest: don't use the system default version of PHP #508

Merged
merged 1 commit into from
Jul 22, 2020

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Jul 22, 2020

... instead use the PHP version used when this script was called.

shell_exec() opens a new process and that process does not inherit the PHP executable which was used to run the tests, but uses the system default PHP version instead, which means that the PHPCS command may run on a different PHP version than the tests.

The current solution is a simple one and not exhaustive, but should suffice in most cases.

If a more complex/more comprehensive solution is desired, I'd recommend using the PhpExecutableFinder from the Symfony\Process package.

Context: I needed this fix to be able to properly investigate #485

... instead use the PHP version used when this script was called.

`shell_exec()` opens a new process and that process does not inherit the PHP executable which was used to run the tests, but uses the system default PHP version instead, which means that the PHPCS command may run on a different PHP version than the tests.

The current solution is a simple one and not exhaustive, but should suffice in most cases.

If a more complex/more comprehensive solution is desired, I'd recommend using the `PhpExecutableFinder` from the `Symfony\Process` package.
@jrfnl jrfnl requested a review from a team as a code owner July 22, 2020 19:56
@GaryJones GaryJones merged commit 4c5007b into develop Jul 22, 2020
@GaryJones GaryJones deleted the fix/rulesettest-dont-use-system-default-php branch July 22, 2020 20:42
@jrfnl jrfnl added this to the 2.2.0 milestone Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants