diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 199d1cc..6db0438 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -48,6 +48,7 @@ Yii Framework 2 Change Log - Bug #10372: Fixed console controller including DI arguments in help (sammousa) - Bug #10385: Fixed `yii\validators\CaptchaValidator` passed incorrect hashKey to JS validator when `captchaAction` begins with `/` (silverfire) - Bug #10467: Fixed `yii\di\Instance::ensure()` to work with minimum settings (LAV45) +- Bug #10541: Fixed division by zero issue in `Console` helper progress bar (youmad) - Bug: Fixed generation of canonical URLs for `ViewAction` pages (samdark) - Bug: Fixed `mb_*` functions calls to use `UTF-8` or `Yii::$app->charset` (silverfire) - Enh #3506: Added `yii\validators\IpValidator` to perform validation of IP addresses and subnets (SilverFire, samdark) diff --git a/framework/helpers/BaseConsole.php b/framework/helpers/BaseConsole.php index d79140a..7a85216 100644 --- a/framework/helpers/BaseConsole.php +++ b/framework/helpers/BaseConsole.php @@ -954,7 +954,7 @@ class BaseConsole self::$_progressEtaLastUpdate = time(); } elseif ($done < $total) { // update ETA once per second to avoid flapping - if (time() - self::$_progressEtaLastUpdate > 1) { + if (time() - self::$_progressEtaLastUpdate > 1 && $done > self::$_progressEtaLastDone) { $rate = (time() - (self::$_progressEtaLastUpdate ?: self::$_progressStart)) / ($done - self::$_progressEtaLastDone); self::$_progressEta = $rate * ($total - $done); self::$_progressEtaLastUpdate = time();