Skip to content

[Console] Question helper is behaving differently when inside a Section #47411

@bigfoot90

Description

@bigfoot90

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy