Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 72ca171

Browse files
committed
bug #37130 [Console] allow cursor to be used even when STDIN is not defined (xabbuh)
This PR was merged into the 5.1 branch. Discussion ---------- [Console] allow cursor to be used even when STDIN is not defined | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #37124 | License | MIT | Doc PR | This allows to use the `Cursor` class introduced in Symfony 5.1 even when the `STDIN` constant is not defined. We did a similar bugfix in the past in the `QuestionHelper` class in #10798. Commits ------- aff1ffa allow cursor to be used even when STDIN is not defined
2 parents 5de548b + aff1ffa commit 72ca171

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Console/Cursor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ final class Cursor
2121
private $output;
2222
private $input;
2323

24-
public function __construct(OutputInterface $output, $input = STDIN)
24+
public function __construct(OutputInterface $output, $input = null)
2525
{
2626
$this->output = $output;
27-
$this->input = $input;
27+
$this->input = $input ?? (\defined('STDIN') ? STDIN : fopen('php://input', 'r+'));
2828
}
2929

3030
public function moveUp(int $lines = 1): self

0 commit comments

Comments
 (0)