8000 [Console] replaced fgets by stream_get_line in DialogHelper · symfony/symfony@3a5d508 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a5d508

Browse files
committed
[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).
1 parent 7eec2ca commit 3a5d508

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Console/Helper/DialogHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function ask(OutputInterface $output, $question, $default = null)
3535
{
3636
$output->write($question);
3737

38-
if (false === $ret = fgets(null === $this->inputStream ? STDIN : $this->inputStream)) {
38+
if (false === stream_get_line(null === $this->inputStream ? STDIN : $this->inputStream, 4096, "\n")) {
3939
throw new \Exception('Aborted');
4040
}
4141
$ret = trim($ret);

0 commit comments

Comments
 (0)
0