Closed ctzkane closed 11 months ago
Thanks for the @ctzkane! This definitely looks like a bug, and I agree with your assessment on the cause.
Feel free to submit a pull request, if you'd like. Here is some guidance on our pull request best practices.
Using make_progress_bar multiple times in a WP_CLI command displays wrong expected total time after the first use.
Repro:
Consider the following cli command
running this results in the following STDOUT output
The expected result should read 0:10 as the expected time for the 2nd and 3rd pass. The numbers shown during the execution are also wrong, calculating a much higher time when each subsequent pass starts.
This is due to the usage of static function variables in php-cli-tools lib/cli/Notify.php
The fix would be to convert those as member variables of the class, or somehow reset them when the Reset method is called.