don't rely on php being in the path #528

Open
wants to merge 9 commits into
from

Projects

None yet

4 participants

@ptarjan

Since we are already in a php scripts, we are guaranteed that there is a php binary on the system, so just use the constant of the currently running execution engine.

(This came up when trying to run your tests on HHVM).

@stof stof commented on an outdated diff Nov 20, 2013
src/Assetic/Factory/Loader/BasePhpFormulaLoader.php
@@ -108,7 +108,11 @@ private function processCall($call, array $protoOptions = array())
$call,
'echo serialize($_call);',
)));
- $args = unserialize(shell_exec('php '.escapeshellarg($tmp)));
+ $php = 'php';
+ if (defined('PHP_BINARY')) {
+ $php = PHP_BINARY;
@stof
stof Nov 20, 2013

wrong indentation

@KingCrunch KingCrunch and 2 others commented on an outdated diff Nov 20, 2013
src/Assetic/Factory/Loader/BasePhpFormulaLoader.php
@@ -108,7 +108,11 @@ private function processCall($call, array $protoOptions = array())
$call,
'echo serialize($_call);',
)));
- $args = unserialize(shell_exec('php '.escapeshellarg($tmp)));
+ $php = 'php';
@KingCrunch
KingCrunch Nov 20, 2013

Just a suggestion, because it should affect platform compatibility, that this affects the platform compatibility

$php = trim(`which php`);
@ptarjan
ptarjan Nov 20, 2013

Shouldn't php be equivalent to which php? One will be fully qualified but I don't think that matters. Both of them will just search the current $PATH

@KingCrunch
KingCrunch Nov 20, 2013

@ptarjan Exactly, but with which you find out, if it exists, before you try to call it :)

@ptarjan
ptarjan Nov 20, 2013

How will that help in this method?

@stof
stof Nov 23, 2013

@KingCrunch Using wich would break the compatibility with Windows

@KingCrunch
KingCrunch Nov 23, 2013

@stof Actually thats what I initially said (even if it wasn't very well written …) I don't know, if there is something similar for windows.

@ptarjan

I don't get it, how is this breaking the JVM tests (even on PHP 5.3)?

@dustingraham

@ptarjan Just a note, on my local machine PHP_BINARY is defined, but resolves to C:\xampp\apache\bin\httpd.exe and C:\xampp\apache\bin\httpd.exe artisan epicly fails.

@dustingraham That is when running through a web server I suppose. Does normal assetic code run through this function or just test code?

@ptarjan No idea! I was just browsing the issues, and hadn't ever used PHP_BINARY before so thought I'd test it. Wanted to give you a heads up in case this was the reason unit tests were failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment