Skip to content

ProgressBar division by 0 when setting $startAt #59067

@Rindula

Description

@Rindula

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

      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