-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Reset question validator attempts only for actual stdin (bis) #37286
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if (!\defined('STDIN')) { | ||
$inputStream = $this->inputStream ?: fopen('php://stdin', 'r'); | ||
|
||
if ('php://stdin' !== (stream_get_meta_data($inputStream)['url'] ?? null)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually this is not needed to fix the failure, but making the behavior of this method global looks suspicious to me so here is a local check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that this check works even if $inputStream === STDIN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure with url
here?
>>> stream_get_meta_data(STDIN)['url']
PHP Notice: Undefined index: url in phar://eval()'d code on line 1
=> null
>>> stream_get_meta_data(STDIN)
=> [
"timed_out" => false,
"blocked" => true,
"eof" => false,
"wrapper_type" => "PHP",
"stream_type" => "STDIO",
"mode" => "rb",
"unread_bytes" => 0,
"seekable" => false,
"uri" => "php://stdin",
]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty much yes: https://3v4l.org/njZZV
What's your runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That 3v4l snippet follows behaviour I observe on my PC, it looks to be uri
, not url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦
return true; | ||
} | ||
|
||
if (\function_exists('stream_isatty')) { | ||
return stream_isatty(fopen('php://input', 'r')); | ||
return stream_isatty($inputStream); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was my mistake: using php://stdin
here instead is enough to fix the failure
0aff5d8
to
8069160
Compare
8069160
to
867642e
Compare
… (weaverryan) This PR was squashed before being merged into the 1.0-dev branch. Discussion ---------- using stable-dev in tests to get latest fixes from Symfony This avoids a behavior change in symfony/console@6f533d9...d2c9f77 from symfony/symfony#37286 I'll create a PR to revert this after merge, which we will merge once the issue is resolved. Commits ------- 1309c01 updating test in one other spot ccfd248 forcing stable ORM in tests 6b512b8 making migration test work in all versions b5a5a11 phpcs 6af124a Guaranteeing that dev versions will get dev dependencies fd89d5d Forcing "stable" for 7.1 73f9ecc updating test for new version of migrations 0334718 Using stable-dev as default version in tests
#37160 fails, this should fix it by looking at the actual input stream.