Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Console] ExceptionListener formatting message error #22449

Closed
grachevko opened this issue Apr 15, 2017 · 3 comments
Closed

[Console] ExceptionListener formatting message error #22449

grachevko opened this issue Apr 15, 2017 · 3 comments

Comments

@grachevko
Copy link
Contributor

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.3.x-DEV

While running non existing command.

Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function getName() on null in /usr/local/app/vendor/symfony/symfony/src/Symfony/Component/Console/EventListener/ExceptionListener.php:70
Stack trace:
#0 /usr/local/app/vendor/symfony/symfony/src/Symfony/Component/Console/EventListener/ExceptionListener.php(42): Symfony\Component\Console\EventListener\ExceptionListener::getInputString(Object(Symfony\Component\Console\Event\ConsoleErrorEvent))
#1 /usr/local/app/var/cache/test/srcTestProjectContainer.php(1661): Symfony\Component\Console\EventListener\ExceptionListener->onConsoleError(Object(Symfony\Component\Console\Event\ConsoleErrorEvent))
#2 [internal function]: srcTestProjectContainer->{closure}(Object(Symfony\Component\Console\Event\ConsoleErrorEvent), 'console.error', Object(Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher))
#3 /usr/local/app/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php(174): call_user_func(Object(Closure), Ob in /usr/local/app/vendor/symfony/symfony/src/Symfony/Component/Console/EventListener/ExceptionListener.php on line 70
@grachevko grachevko changed the title Console ExceptionListener error formatting message Console ExceptionListener formatting message error Apr 15, 2017
@grachevko grachevko changed the title Console ExceptionListener formatting message error [Console] ExceptionListener formatting message error Apr 15, 2017
@ro0NL
Copy link
Contributor

ro0NL commented Apr 16, 2017

Probably related to #22322

@chalasr
Copy link
Member

chalasr commented Apr 16, 2017

Indeed, fixed by #22322

@chalasr
Copy link
Member

chalasr commented Apr 18, 2017

@fabpot #22322 is not merged yet

fabpot added a commit that referenced this issue Apr 19, 2017
…ut command (chalasr)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[Console] Fix fatal error when logging console.error without command

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

Happens now that the console.error event is dispatched on command not found, I  ran into using `server:run` on 3.3 without `web-server-bundle` enabled:

> PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function getName() on null

In this case, this first tries to cast the event input as string (less good than when the command name is available, there're extra quotes around the command name) and, if can't be casted, uses a generic message.

Commits
-------

97129fc Fix fatal error when logging console.error without a command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants