1
0
Fork 0

Fix detection of PHP files to match also broken ones with leading whitespace or whitespace between shebang and <?php, refs jakzal/phpqa#336

pull/10409/head
Jordi Boggiano 2021-12-30 21:23:17 +01:00
parent 84f8fda0c6
commit d1d5d75c5f
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 1 additions and 1 deletions

View File

@ -258,7 +258,7 @@ class BinaryInstaller
$binContents = file_get_contents($bin); $binContents = file_get_contents($bin);
// For php files, we generate a PHP proxy instead of a shell one, // For php files, we generate a PHP proxy instead of a shell one,
// which allows calling the proxy with a custom php process // 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 // carry over the existing shebang if present, otherwise add our own
$proxyCode = empty($match[1]) ? '#!/usr/bin/env php' : trim($match[1]); $proxyCode = empty($match[1]) ? '#!/usr/bin/env php' : trim($match[1]);
$binPathExported = $this->filesystem->findShortestPathCode($link, $bin, false, true); $binPathExported = $this->filesystem->findShortestPathCode($link, $bin, false, true);