123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace Symfony\Component\Process;
- use Symfony\Component\Process\Exception\RuntimeException;
- class PhpProcess extends Process
- {
-
- public function __construct(string $script, string $cwd = null, array $env = null, int $timeout = 60, array $php = null)
- {
- if (null === $php) {
- $executableFinder = new PhpExecutableFinder();
- $php = $executableFinder->find(false);
- $php = false === $php ? null : array_merge([$php], $executableFinder->findArguments());
- }
- if ('phpdbg' === \PHP_SAPI) {
- $file = tempnam(sys_get_temp_dir(), 'dbg');
- file_put_contents($file, $script);
- register_shutdown_function('unlink', $file);
- $php[] = $file;
- $script = null;
- }
- parent::__construct($php, $cwd, $env, $script, $timeout);
- }
-
- public function setPhpBinary($php)
- {
- @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the $php argument of the constructor instead.', __METHOD__), E_USER_DEPRECATED);
- $this->setCommandLine($php);
- }
-
- public function start(callable $callback = null, array $env = [])
- {
- if (null === $this->getCommandLine()) {
- throw new RuntimeException('Unable to find the PHP executable.');
- }
- parent::start($callback, $env);
- }
- }
|