Silence warnings during tty detection#43149
Merged
Merged
Conversation
|
Hey! I think @greg0ire has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
Member
|
@neclimdul please also report that to PHP. I think the behavior deserved being fixed in PHP, even if we can work around it. |
Contributor
Author
|
Sure thing. Not sure this sort of thing will get a lot of attention but it would be a good fix in some future version of PHP. |
Member
|
Can you please target 4.4, and fix all calls to the function (there are more in the codebase)? |
0856749 to
3dc53a4
Compare
Member
|
Thank you @neclimdul. |
Contributor
Author
|
sorry i didn't see the note about the target. thanks for taking care of this! |
This was referenced Jan 28, 2022
Merged
Merged
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the DeprecationErrorHandler checks if it should colorize the output, in certain circumstances it can trigger the following warning:
This is triggered by some admittedly poor behavior inside of php.
stream_isattychecks by doing a cast and looking for a failure and one of those failures logs a warning. You generally don't want to trigger warnings during a capabilities check(that's why I'm filing this) but PHP is doing just that.This can lead to test suite failures since warnings are generally treated as failures by most test suites.
I think a test case to trigger the deprecation handler might be tricky but a simplified test case to trigger the warning in php looks like this.
https://3v4l.org/0EHT4
A real world example of a test suite that is wrapping stdout with a stream wrapper during testing is Drupal. Feature addition
References:
stream_isatty definition
cast line that triggers warning