{"action":"opened","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/28701","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/28701/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/28701/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/28701/events","html_url":"https://github.com/symfony/symfony/issues/28701","id":366293513,"node_id":"MDU6SXNzdWUzNjYyOTM1MTM=","number":28701,"title":"CacheClearCommand does not dispatch `console.terminate`","user":{"login":"ricardodnb","id":6843165,"node_id":"MDQ6VXNlcjY4NDMxNjU=","avatar_url":"https://avatars2.githubusercontent.com/u/6843165?v=4","gravatar_id":"","url":"https://api.github.com/users/ricardodnb","html_url":"https://github.com/ricardodnb","followers_url":"https://api.github.com/users/ricardodnb/followers","following_url":"https://api.github.com/users/ricardodnb/following{/other_user}","gists_url":"https://api.github.com/users/ricardodnb/gists{/gist_id}","starred_url":"https://api.github.com/users/ricardodnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricardodnb/subscriptions","organizations_url":"https://api.github.com/users/ricardodnb/orgs","repos_url":"https://api.github.com/users/ricardodnb/repos","events_url":"https://api.github.com/users/ricardodnb/events{/privacy}","received_events_url":"https://api.github.com/users/ricardodnb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-03T11:30:13Z","updated_at":"2018-10-03T11:30:13Z","closed_at":null,"author_association":"NONE","body":"**Symfony version(s) affected**: 3.4.14\r\n\r\n**Description**  \r\nI have an event listener for `console.terminate` declared in  a service but it wont get executed after `cache:clear` terminates because the listeners are being cleared from `EventDispatcher` during the execution.\r\n\r\nThe project was migrated from symfony 2.8 to 3.4\r\n\r\nCache clear does not allow console.terminate listeners anymore?\r\n\r\n**How to reproduce** \r\n- Add a listener for `console.terminate` on services.yml service definition\r\n- Log the listeners from event dispatcher before cache clear code executes - Listener is there\r\n- Run cache:clear command \r\n- Listener is not called because when `dispatch` is called the listener is no longer there.\r\n\r\n**Possible Solution**  \r\nI think the problem is this line resetting the `EventDispatcher`, what is the main purpose for this set of a new instance of eventDispatcher on the application?\r\n```\r\n// The current event dispatcher is stale, let's not use it anymore\r\n$this->getApplication()->setDispatcher(new EventDispatcher());\r\n```"}}
{"actor":{"display_login":"ricardodnb"}}