From 4537df9d922b3c2e5fe8296a79ca1b5eb1528d96 Mon Sep 17 00:00:00 2001 From: Varun Sridharan Date: Tue, 2 Jul 2019 10:13:38 +0530 Subject: [PATCH] [Fixed] Division by zero | class-batch.php on line 189 Warning: Division by zero in E:\localhost\www\wp\framework\wponion\wp-content\plugins\wp-batch-processing-master\includes\class-batch.php on line 189 --- includes/class-batch.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-batch.php b/includes/class-batch.php index 0d9ace2..09b5474 100644 --- a/includes/class-batch.php +++ b/includes/class-batch.php @@ -186,7 +186,7 @@ public function get_items_count() { public function get_percentage() { $total_items = $this->get_items_count(); $total_processed = $this->get_processed_count(); - $percentage = 100 - ( ( ( $total_items - $total_processed ) / $total_items ) * 100 ); + $percentage = ( ! empty( $total_items ) ) ? 100 - ( ( ( $total_items - $total_processed ) / $total_items ) * 100 ) : 0; return number_format( (float) $percentage, 2, '.', '' ); } @@ -206,4 +206,4 @@ public function restart() { delete_option( $this->get_db_identifier() ); } -} \ No newline at end of file +}