Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ProgressBar division by 0 when setting $startAt #59067

Copy link
Copy link
Closed
@Rindula

Description

@Rindula
Issue body actions

Symfony version(s) affected

7.2.0

Description

When using the Progressbar and having a custom format using the %remaining% part, the Progressbar will error with

In ProgressBar.php line 236:

  Division by zero

How to reproduce

  1. Create a console command using the Progressbar
  2. Initiate a new Progressbar Object $pb = new ProgressBar($io, $total);
  3. Start the Progressbar with $pb->start($total, $skip); where $total > $skip > 0

Possible Solution

Change in ProgressBar.php line 232 - 234 from

if (!$this->step) {
    return 0;
}

to

if (0 === $this->step || $this->step === $this->startingStep) {
    return 0;
}

as in getEstimated()

Additional Context

No response

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.