bug #38114 [Console] guard $argv + $token against null, preventing unnecessary exceptions (bilogic)

This PR was submitted for the 4.4 branch but it was merged into the 3.4 branch instead.

Discussion
----------

[Console] guard $argv + $token against null, preventing unnecessary exceptions

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| Tickets       | Fix https://github.com/symfony/symfony/issues/38105
| License       | MIT

This issue was causing an unnecessary exception, leading to difficulty in locating the actual offending code as reported by many cases as detailed in #38105

Commits
-------

dbe335d9be guard $argv + $token against null, preventing unnecessary exceptions
This commit is contained in:
Nicolas Grekas 2020-09-08 22:57:49 +02:00
commit 68866fbc9e

View File

@ -49,9 +49,7 @@ class ArgvInput extends Input
*/
public function __construct(array $argv = null, InputDefinition $definition = null)
{
if (null === $argv) {
$argv = $_SERVER['argv'];
}
$argv = $argv ?? $_SERVER['argv'] ?? [];
// strip the application name
array_shift($argv);