Closed
Description
Symfony version(s) affected
6.1.4
Description
The question helper is going onto a new line when used inside a Section, therefore section cannot rewrite correctly
How to reproduce
Question helper only
Code
$io = new SymfonyStyle($input, $output);
$countdown = 3;
while ($countdown > 0) {
$io->write('Lorem ipsum ' . $countdown);
$random = $io->ask('Press random key');
$countdown--;
}
Section helper only
Code
$section = $output->section();
$countdown = 3;
while ($countdown > 0) {
$section->clear();
$section->write('Lorem ipsum ' . $countdown);
$countdown--;
sleep(1);
}
Both combined
Code
$section = $output->section();
$io = new SymfonyStyle($input, $section);
$countdown = 3;
while ($countdown > 0) {
$section->clear();
$section->write('Lorem ipsum ' . $countdown);
$random = $io->ask('Press random key');
$countdown--;
}
Expected
Final output should be
Lorem ipsum 1
Press random key:
> something