Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ArgvInput throws an exception that does not link back to offending code #38105

Copy link
Copy link
Closed
@bilogic

Description

@bilogic
Issue body actions

Symfony version(s) affected:
symfony/console v4.4.13 Symfony Console Component

Description

Referring to this class, https://github.com/symfony/console/blob/master/Input/ArgvInput.php, I ran into a situation where $argv is NULL by default and in turn caused $this->tokens to be NULL. This will cause an exception to be thrown when foreach() is applied on $this->tokens below:

How to reproduce

Many have reported about it in the past decade:

Possible Solution

Never allow $this->tokens to be NULL, at minimum, it should be an empty array.

  1. In __construct(), change the assign to call $this->setTokens($argv);
  2. In setTokens(), if (null == $tokens) $tokens = [];

Additional context

In the cases above (including my own), this exception does not link back to the offending code and becomes a real challenge to trace. I can submit a PR. Thank you.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.