The variable MUST be an integer. Test it and convert it if needed. (#350)

This commit is contained in:
Romain Biard 2017-04-12 14:20:33 -03:00 committed by GitHub
commit eebdbea1f7

View file

@ -179,6 +179,12 @@ abstract class AbstractProgressListener extends EventEmitter implements Listener
if ($this->lastOutput !== null) {
$delta = $currentTime - $this->lastOutput;
// Check the type of the currentSize variable and convert it to an integer if needed.
if(!is_numeric($currentSize)) {
$currentSize = (int)$currentSize;
}
$deltaSize = $currentSize - $this->currentSize;
$rate = $deltaSize * $delta;
if ($rate > 0) {