Skip to content

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

Merged
GaryJones merged 1 commit intodevelopfrom
fix/rulesettest-dont-use-system-default-php
Jul 22, 2020
Merged

RulesetTest: don't use the system default version of PHP#508
GaryJones merged 1 commit intodevelopfrom
fix/rulesettest-dont-use-system-default-php

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