Silence warnings during tty detection #43149
Merged
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_isatty
checks 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