diff --git a/composer.json b/composer.json index 8a78ce9b10cf..9a5f2b500b4c 100644 --- a/composer.json +++ b/composer.json @@ -133,6 +133,7 @@ "src/Illuminate/Filesystem/functions.php", "src/Illuminate/Foundation/helpers.php", "src/Illuminate/Log/functions.php", + "src/Illuminate/Support/functions.php", "src/Illuminate/Support/helpers.php" ], "psr-4": { diff --git a/src/Illuminate/Console/Application.php b/src/Illuminate/Console/Application.php index 8e92793855fc..55d1ca33eca2 100755 --- a/src/Illuminate/Console/Application.php +++ b/src/Illuminate/Console/Application.php @@ -16,7 +16,8 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Output\BufferedOutput; -use Symfony\Component\Process\PhpExecutableFinder; + +use function Illuminate\Support\php_binary; class Application extends SymfonyApplication implements ApplicationContract { @@ -84,7 +85,7 @@ public function __construct(Container $laravel, Dispatcher $events, $version) */ public static function phpBinary() { - return ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false) ?: 'php'); + return ProcessUtils::escapeArgument(php_binary()); } /** diff --git a/src/Illuminate/Foundation/Console/InteractsWithComposerPackages.php b/src/Illuminate/Foundation/Console/InteractsWithComposerPackages.php index ebd8b7e7b3d1..4628f2946b8d 100644 --- a/src/Illuminate/Foundation/Console/InteractsWithComposerPackages.php +++ b/src/Illuminate/Foundation/Console/InteractsWithComposerPackages.php @@ -2,9 +2,10 @@ namespace Illuminate\Foundation\Console; -use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\Process; +use function Illuminate\Support\php_binary; + trait InteractsWithComposerPackages { /** @@ -39,6 +40,6 @@ protected function requireComposerPackages(string $composer, array $packages) */ protected function phpBinary() { - return (new PhpExecutableFinder())->find(false) ?: 'php'; + return php_binary(); } } diff --git a/src/Illuminate/Queue/Listener.php b/src/Illuminate/Queue/Listener.php index 58a28ee18284..271a7c3b4d8e 100755 --- a/src/Illuminate/Queue/Listener.php +++ b/src/Illuminate/Queue/Listener.php @@ -3,9 +3,10 @@ namespace Illuminate\Queue; use Closure; -use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\Process; +use function Illuminate\Support\php_binary; + class Listener { /** @@ -61,7 +62,7 @@ public function __construct($commandPath) */ protected function phpBinary() { - return (new PhpExecutableFinder)->find(false) ?: 'php'; + return php_binary(); } /** diff --git a/src/Illuminate/Support/Composer.php b/src/Illuminate/Support/Composer.php index 3725394e017d..190500a4fe32 100644 --- a/src/Illuminate/Support/Composer.php +++ b/src/Illuminate/Support/Composer.php @@ -6,7 +6,6 @@ use Illuminate\Filesystem\Filesystem; use RuntimeException; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\Process; class Composer @@ -204,7 +203,7 @@ protected function findComposerFile() */ protected function phpBinary() { - return (new PhpExecutableFinder)->find(false) ?: 'php'; + return php_binary(); } /** diff --git a/src/Illuminate/Support/Process/PhpExecutableFinder.php b/src/Illuminate/Support/Process/PhpExecutableFinder.php new file mode 100644 index 000000000000..6b9698f85bf1 --- /dev/null +++ b/src/Illuminate/Support/Process/PhpExecutableFinder.php @@ -0,0 +1,21 @@ +find('php', false, [implode(DIRECTORY_SEPARATOR, [$herdPath, 'bin'])]); + } + + return parent::find($includeArgs); + } +} diff --git a/src/Illuminate/Support/composer.json b/src/Illuminate/Support/composer.json index 8995ed9655fc..3da999fd887f 100644 --- a/src/Illuminate/Support/composer.json +++ b/src/Illuminate/Support/composer.json @@ -37,6 +37,7 @@ "Illuminate\\Support\\": "" }, "files": [ + "functions.php", "helpers.php" ] }, diff --git a/src/Illuminate/Support/functions.php b/src/Illuminate/Support/functions.php new file mode 100644 index 000000000000..40e4d7befeea --- /dev/null +++ b/src/Illuminate/Support/functions.php @@ -0,0 +1,15 @@ +find(false) ?: 'php'; +}