Skip to content

Off-by-one error in progress bar example code #127

@schlessera

Description

@schlessera

The example code contains an off-by-one error in its test_notify() method:
https://github.com/wp-cli/php-cli-tools/blob/master/examples/common.php#L20

From the original report by @lf-jeremy:

The test_notify function has a default cycle of 1000000 iterations. The example constructors for \cli\Progress\bar objects pass a size of 1000000 steps. However, the for loop inside test_notify starts at 0 and goes to $cycle inclusive.

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