Skip to content

Commit

Permalink
Fixed inconsistent string handling in SUM() implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
betterphp committed Jul 27, 2023
1 parent d6e2e24 commit 1b443bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PhpSpreadsheet/Calculation/MathTrig/Sum.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static function sumIgnoringStrings(...$args)
foreach (Functions::flattenArray($args) as $arg) {
// Is it a numeric value?
if (is_numeric($arg)) {
$returnValue += $arg;
$returnValue += (float) $arg;
} elseif (ErrorValue::isError($arg)) {
return $arg;
}
Expand Down Expand Up @@ -58,7 +58,7 @@ public static function sumErroringStrings(...$args)
// Is it a numeric value?
if (is_numeric($arg) || empty($arg)) {
if (is_string($arg)) {
$arg = (int) $arg;
$arg = (float) $arg;
}
$returnValue += $arg;
} elseif (is_bool($arg)) {
Expand Down

0 comments on commit 1b443bc

Please sign in to comment.