Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Silence warnings during tty detection#43149

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:4.4fromneclimdul:silence_isatty
Jan 26, 2022

Conversation

@neclimdul
Copy link
Contributor

@neclimdulneclimdul commentedSep 23, 2021
edited by nicolas-grekas
Loading

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
Ticketsn/a
LicenseMIT
Doc PR

When the DeprecationErrorHandler checks if it should colorize the output, in certain circumstances it can trigger the following warning:

 Warning: stream_isatty(): cannot cast a filtered stream on this system in /app/vendor/symfony/phpunit-bridge/DeprecationErrorHandler.php on line 411

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.

class strtoupper_filterextends php_user_filter {  #[\ReturnTypeWillChange]functionfilter($in,$out, &$consumed,$closing)  {while ($bucket =stream_bucket_make_writeable($in)) {$bucket->data =strtoupper($bucket->data);$consumed +=$bucket->datalen;stream_bucket_append($out,$bucket);    }returnPSFS_PASS_ON;  }}$stdout =fopen('php://stdout','wb');stream_filter_register('capture', strtoupper_filter::class);stream_filter_append($stdout,'capture');var_export(stream_isatty($stdout));

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

andypost reacted with thumbs up emoji
@carsonbot
Copy link

Hey!

I think@greg0ire has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@stof
Copy link
Member

@neclimdul please also report that to PHP. I think the behavior deserved being fixed in PHP, even if we can work around it.

cmb69 reacted with thumbs up emoji

@neclimdul
Copy link
ContributorAuthor

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.

https://bugs.php.net/bug.php?id=81475

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedJan 26, 2022
edited
Loading

Can you please target 4.4, and fix all calls to the function (there are more in the codebase)?

@nicolas-grekasnicolas-grekas changed the titleSilence warnings during DeprecationErrorHandler tty detectionSilence warnings during tty detectionJan 26, 2022
@nicolas-grekasnicolas-grekas modified the milestones:5.3,4.4Jan 26, 2022
@nicolas-grekas
Copy link
Member

Thank you@neclimdul.

neclimdul reacted with hooray emoji

@nicolas-grekasnicolas-grekas merged commit67de62f intosymfony:4.4Jan 26, 2022
@neclimdul
Copy link
ContributorAuthor

sorry i didn't see the note about the target. thanks for taking care of this!

This was referencedJan 28, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

@dunglasdunglasAwaiting requested review from dunglas

@lyrixxlyrixxAwaiting requested review from lyrixx

@wouterjwouterjAwaiting requested review from wouterj

@xabbuhxabbuhAwaiting requested review from xabbuh

@ycerutoycerutoAwaiting requested review from yceruto

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

4 participants

@neclimdul@carsonbot@stof@nicolas-grekas

[8]ページ先頭

©2009-2025 Movatter.jp