Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Conversation

exussum12
Copy link
Contributor

Currently when multiple versions are installed, calling parallel lint
with any of them invokes the default php on the path.

@VasekPurchart
Copy link
Contributor

I don't think the condition is enough, because $_SERVER['_'] contains the executable which was used to run the PHP script which is fine, if you invoke the lint as php parallel-lint, but it's not okay, when you run the tool directly: ./parallel-lint, then it would contain the parallel-lint executable, which is obviously not something you want to use to run the linting process.

Also these values of $_SERVER are not documented, so I am not sure, if it is ok, to rely on them, at least it should be tested, that it is populated.

@exussum12
Copy link
Contributor Author

What about using realpath ('/proc/self/exe')

That should work in both cases ?

@fprochazka
Copy link
Contributor

There is a PHP_BINARY, since PHP 5.4, that should be imho prefered, if available.

@exussum12
Copy link
Contributor Author

Added that check @fprochazka Thanks!

@exussum12
Copy link
Contributor Author

Error on the build is HHVM being unsupported

@exussum12
Copy link
Contributor Author

Travis seem to have dropped 5,3 support too. Removing that from the build

@JakubOnderka
Copy link
Owner

Nice catch! I fixed build in master branch, can you please remove commits that change build and rebase it to current master?

@exussum12
Copy link
Contributor Author

Updated

src/Settings.php Outdated
$arguments = new ArrayIterator(array_slice($arguments, 1));
$settings = new self;

//use the currently invoked php as the default if possible
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just small code style: Can you please put space after // and start commend with big letter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

src/Settings.php Outdated
$settings = new self;

// Use the currently invoked php as the default if possible
if (defined(PHP_BINARY)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defined takes string with a constant name as an argument, so here it checks if a constant with name /usr/bin/php or alike (PHP_BINARY's value) is defined which would most likely be false, so $settings->phpExecutable will likely never be set. Shouldn't it be defined('PHP_BINARY')?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True! @exussum12 Can you fix it?

@exussum12
Copy link
Contributor Author

Good spot. Sorted

@kamazee
Copy link
Contributor

kamazee commented Aug 24, 2018

Testing concerns should also be addressed, I guess.
Other than that — thanks for the useful addition! That's something that could be useful for me as well 👍

@JakubOnderka JakubOnderka merged commit 465183b into JakubOnderka:master Sep 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants