Skip to content

Commit

Permalink
fixup! fixup!
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpozzi committed Feb 14, 2020
1 parent 70aa35e commit 5e04f87
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions tests/Knp/Snappy/AbstractGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,17 +566,19 @@ private function getPHPExecutableFromPath(): ?string
return PHP_BINARY;
}

if (false !== getenv('PATH')) {
$paths = explode(PATH_SEPARATOR, getenv('PATH'));
foreach ($paths as $path) {
// we need this for XAMPP (Windows)
if (strstr($path, 'php.exe') && isset($_SERVER['WINDIR']) && file_exists($path) && is_file($path)) {
return $path;
} else {
$php_executable = $path . DIRECTORY_SEPARATOR . 'php' . (isset($_SERVER['WINDIR']) ? '.exe' : '');
if (file_exists($php_executable) && is_file($php_executable)) {
return $php_executable;
}
if (false === getenv('PATH')) {
return null;
}

$paths = explode(PATH_SEPARATOR, getenv('PATH'));
foreach ($paths as $path) {
// we need this for XAMPP (Windows)
if (strstr($path, 'php.exe') && isset($_SERVER['WINDIR']) && file_exists($path) && is_file($path)) {
return $path;
} else {
$php_executable = $path . DIRECTORY_SEPARATOR . 'php' . (isset($_SERVER['WINDIR']) ? '.exe' : '');
if (file_exists($php_executable) && is_file($php_executable)) {
return $php_executable;
}
}
}
Expand Down

0 comments on commit 5e04f87

Please sign in to comment.