From 3a5d508766f0480c3f1b525677e45dafd953f5bf Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 7 Jul 2011 09:25:46 +0200 Subject: [PATCH] [Console] replaced fgets by stream_get_line in DialogHelper Problem with fgets is that false means two things: an error or the end of the stream. That's ok for STDIN, but it becomes a problem when using another stream (in a unit test for instance). --- src/Symfony/Component/Console/Helper/DialogHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Helper/DialogHelper.php b/src/Symfony/Component/Console/Helper/DialogHelper.php index 0d8cab3394..f8f5f7d9e9 100644 --- a/src/Symfony/Component/Console/Helper/DialogHelper.php +++ b/src/Symfony/Component/Console/Helper/DialogHelper.php @@ -35,7 +35,7 @@ class DialogHelper extends Helper { $output->write($question); - if (false === $ret = fgets(null === $this->inputStream ? STDIN : $this->inputStream)) { + if (false === stream_get_line(null === $this->inputStream ? STDIN : $this->inputStream, 4096, "\n")) { throw new \Exception('Aborted'); } $ret = trim($ret);