bug #25304 [Bridge/PhpUnit] Prefer $_SERVER['argv'] over $argv (ricknox)

This PR was submitted for the master branch but it was squashed and merged into the 3.3 branch instead (closes #25304).

Discussion
----------

[Bridge/PhpUnit] Prefer $_SERVER['argv'] over $argv

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

This makes the script usable even if it is wrapped into another script, which is what some IDEs like PHPStorm do.

Commits
-------

1ff22e6acc [Bridge/PhpUnit] Prefer ['argv'] over
This commit is contained in:
Fabien Potencier 2017-12-04 12:15:54 -08:00
commit 31e4533f13
1 changed files with 3 additions and 0 deletions

View File

@ -108,6 +108,9 @@ EOPHP
}
global $argv, $argc;
$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();
$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0;
$components = array();
$cmd = array_map('escapeshellarg', $argv);
$exit = 0;