PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.12.4
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.12.4
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / vendor / symfony / process / PhpExecutableFinder.php

PhpExecutableFinder.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.12.4, at vendor/symfony/process/PhpExecutableFinder.php

93 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Process;
13
14 /**
15 * An executable finder specifically designed for the PHP executable.
16 *
17 * @author Fabien Potencier <[email protected]>
18 * @author Johannes M. Schmitt <[email protected]>
19 */
20 class PhpExecutableFinder
21 {
22 private ExecutableFinder $executableFinder;
23
24 public function __construct()
25 {
26 $this->executableFinder = new ExecutableFinder();
27 }
28
29 /**
30 * Finds The PHP executable.
31 */
32 public function find(bool $includeArgs = true): string|false
33 {
34 if ($php = getenv('PHP_BINARY')) {
35 if (!is_executable($php) && !$php = $this->executableFinder->find($php)) {
36 return false;
37 }
38
39 if (@is_dir($php)) {
40 return false;
41 }
42
43 return $php;
44 }
45
46 $args = $this->findArguments();
47 $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
48
49 // PHP_BINARY return the current sapi executable
50 if (\PHP_BINARY && \in_array(\PHP_SAPI, ['cli', 'cli-server', 'phpdbg'], true)) {
51 return \PHP_BINARY.$args;
52 }
53
54 if ($php = getenv('PHP_PATH')) {
55 if (!@is_executable($php) || @is_dir($php)) {
56 return false;
57 }
58
59 return $php;
60 }
61
62 if ($php = getenv('PHP_PEAR_PHP_BIN')) {
63 if (@is_executable($php) && !@is_dir($php)) {
64 return $php;
65 }
66 }
67
68 if (@is_executable($php = \PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php')) && !@is_dir($php)) {
69 return $php;
70 }
71
72 $dirs = [\PHP_BINDIR];
73 if ('\\' === \DIRECTORY_SEPARATOR) {
74 $dirs[] = 'C:\xampp\php\\';
75 }
76
77 return $this->executableFinder->find('php', false, $dirs);
78 }
79
80 /**
81 * Finds the PHP executable arguments.
82 */
83 public function findArguments(): array
84 {
85 $arguments = [];
86 if ('phpdbg' === \PHP_SAPI) {
87 $arguments[] = '-qrr';
88 }
89
90 return $arguments;
91 }
92 }
93