bug #35113 [VarDumper] Fix "Undefined index: argv" when using CliContextProvider (xepozz)

This PR was submitted for the master branch but it was merged into the 4.3 branch instead.

Discussion
----------

[VarDumper] Fix "Undefined index: argv" when using CliContextProvider

| Q             | A
| ------------- | ---
| Branch?       | 4.1, 4.2, 4.3, 4.4 or 5.0<!-- see below -->
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #35084
| License       | MIT
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Always add tests and ensure they pass.
 - Never break backward compatibility (see https://symfony.com/bc).
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too.)
 - Features and deprecations must be submitted against branch master.
-->

Commits
-------

340bb145d9 Fixed #35084
This commit is contained in:
Nicolas Grekas 2019-12-28 15:52:21 +01:00
commit 9876de2a28

View File

@ -25,7 +25,7 @@ final class CliContextProvider implements ContextProviderInterface
}
return [
'command_line' => $commandLine = implode(' ', $_SERVER['argv']),
'command_line' => $commandLine = implode(' ', $_SERVER['argv'] ?? []),
'identifier' => hash('crc32b', $commandLine.$_SERVER['REQUEST_TIME_FLOAT']),
];
}