Skip to content

Conversation

@jderusse
Copy link
Member

@jderusse jderusse commented Nov 4, 2020

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #38981
License MIT
Doc PR -

Taking the @wouterj 's comment into account (#38981 (comment))

This PR prevents using the same Formatter for stdOut and stdErr when possible.

When user send a custom formatter (or call setFormatter) the previous logic is kept.
Otherwise, symfony is asked to create the Formatter, and thus is able to clone the formatter.

In a future PR targeting 5.3, we could improve the constructor to let people inject 2 distinguished formatters

@wouterj
Copy link
Member

wouterj commented Nov 4, 2020

Thanks for your quick response! This solution works for me, it should be BC (the OutputFormatter is clonable). I've quickly verified this fix and it indeed fixes the cases described in the issue.

I think it's a good idea to add a test for this, to make sure we don't break it in a later patch version. And maybe add a code comment that this is only done when $formatter === null for BC reasons?

@jderusse
Copy link
Member Author

jderusse commented Nov 5, 2020

I think it's a good idea to add a test for this

Added unit tests.

@chalasr
Copy link
Member

chalasr commented Nov 5, 2020

Thank you @jderusse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants