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
< 5021 td data-grid-cell-id="diff-4bf93bf30a08f1221241a44446040105b722af40655648d4ed6bee2bbec8b5d8-38-38-0" data-selected="false" role="gridcell" style="background-color:var(--diffBlob-additionNum-bgColor, var(--diffBlob-addition-bgColor-num));text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative left-side">
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