mirror of
https://github.com/e107inc/e107.git
synced 2025-07-25 00:41:52 +02:00
Issue #5079 - Avoid division by zero.
This commit is contained in:
@@ -2320,7 +2320,7 @@ class e_form
|
||||
|
||||
// $multiplier = 100 / (int) $denom;
|
||||
|
||||
$value = ((int) $score / (int) $denom) * 100;
|
||||
$value = !empty($denom) ? ((int) $score / (int) $denom) * 100 : 0;
|
||||
|
||||
// $value = (int) $score * (int) $multiplier;
|
||||
$percVal = round((float) $value).'%';
|
||||
|
@@ -493,6 +493,7 @@ class e_formTest extends \Codeception\Test\Unit
|
||||
3 => array('value' => '30%', 'expected' => 'width: 30%'),
|
||||
4 => array('value' => '30.4%', 'expected' => 'width: 30%'),
|
||||
5 => array('value' => '30.5%', 'expected' => 'width: 31%'),
|
||||
6 => array('value' => '0/0', 'expected' => 'width: 0%'),
|
||||
);
|
||||
|
||||
foreach($tests as $var)
|
||||
|
Reference in New Issue
Block a user