Skip to content

Commit

Permalink
🐛 Fixed error PHP binary path when running in cgi mode. #18
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Apr 2, 2017
1 parent 2fef65c commit 2488483
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Linter.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,15 @@ public function lint($files = [], $cache = true)
$errors = [];
$running = [];
$newCache = [];
$phpbin = PHP_SAPI == 'cli' ? PHP_BINARY : PHP_BINDIR .'/php';

while (!empty($files) || !empty($running)) {
for ($i = count($running); !empty($files) && $i < $this->procLimit; ++$i) {
$file = array_shift($files);
$filename = $file->getRealpath();

if (!isset($this->cache[$filename]) || $this->cache[$filename] !== md5_file($filename)) {
$running[$filename] = new Lint(PHP_BINARY.' -d error_reporting=E_ALL -d display_errors=On -l '.escapeshellarg($filename));
$running[$filename] = new Lint($phpbin.' -d error_reporting=E_ALL -d display_errors=On -l '.escapeshellarg($filename));
$running[$filename]->start();
} else {
$newCache[$filename] = $this->cache[$filename];
Expand Down

0 comments on commit 2488483

Please sign in to comment.