Skip to content

Commit 79f5cf9

Browse files
author
MarkBaker
committed
Resolve Issue #2833, NULL value handling in PRODUCT() Excel function
1 parent 092ddbd commit 79f5cf9

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/PhpSpreadsheet/Calculation/MathTrig/Operations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static function product(...$args)
108108
// Loop through arguments
109109
foreach (Functions::flattenArray($args) as $arg) {
110110
// Is it a numeric value?
111-
if (is_numeric($arg)) {
111+
if (is_numeric($arg) || $arg === null) {
112112
if ($returnValue === null) {
113113
$returnValue = $arg;
114114
} else {

tests/data/Calculation/MathTrig/PRODUCT.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@
4848
-6.7800000000000002,
4949
-2,
5050
],
51+
[
52+
0,
53+
12.5,
54+
null,
55+
2.5,
56+
],
57+
[
58+
0,
59+
12.5,
60+
2.5,
61+
null,
62+
],
5163
['#VALUE!', 1, 'y', 3],
5264
[6, 1, '2', 3],
5365
];

0 commit comments

Comments
 (0)