From 6d089ac437615732322609af677dba56e414be29 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 5 May 2020 11:01:49 +0200 Subject: [PATCH] [Console] fix "data lost during stream conversion" with QuestionHelper --- src/Symfony/Component/Console/Helper/QuestionHelper.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/QuestionHelper.php b/src/Symfony/Component/Console/Helper/QuestionHelper.php index 4e0afeae78a0d..92f9ddcff3552 100644 --- a/src/Symfony/Component/Console/Helper/QuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/QuestionHelper.php @@ -462,10 +462,6 @@ private function validateAttempts(callable $interviewer, OutputInterface $output $error = null; $attempts = $question->getMaxAttempts(); - if (null === $attempts && !$this->isTty()) { - $attempts = 1; - } - while (null === $attempts || $attempts--) { if (null !== $error) { $this->writeError($output, $error); @@ -477,6 +473,8 @@ private function validateAttempts(callable $interviewer, OutputInterface $output throw $e; } catch (\Exception $error) { } + + $attempts = $attempts ?? -(int) $this->isTty(); } throw $error; @@ -517,7 +515,7 @@ private function isTty(): bool return stream_isatty($inputStream); } - if (!\function_exists('posix_isatty')) { + if (\function_exists('posix_isatty')) { return posix_isatty($inputStream); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy