Fix detection of PHP files to match also broken ones with leading whitespace or whitespace between shebang and <?php, refs jakzal/phpqa#336
parent
84f8fda0c6
commit
d1d5d75c5f
|
@ -258,7 +258,7 @@ class BinaryInstaller
|
|||
$binContents = file_get_contents($bin);
|
||||
// For php files, we generate a PHP proxy instead of a shell one,
|
||||
// which allows calling the proxy with a custom php process
|
||||
if (Preg::isMatch('{^(#!.*\r?\n)?<\?php}', $binContents, $match)) {
|
||||
if (Preg::isMatch('{^(#!.*\r?\n)?[\r\n\t ]*<\?php}', $binContents, $match)) {
|
||||
// carry over the existing shebang if present, otherwise add our own
|
||||
$proxyCode = empty($match[1]) ? '#!/usr/bin/env php' : trim($match[1]);
|
||||
$binPathExported = $this->filesystem->findShortestPathCode($link, $bin, false, true);
|
||||
|
|
Loading…
Reference in New Issue