Skip to content

Commit db00b90

Browse files
authored
Merge pull request #2834 from PHPOffice/Issue-2833_Null-handling-in-PRODUCT()-Function
NULL value handling in PRODUCT() Excel function
2 parents 092ddbd + 2b9b42d commit db00b90

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
2828
### Fixed
2929

3030
- Xls Reader resolving absolute named ranges to relative ranges [Issue #2826](https://github.com/PHPOffice/PhpSpreadsheet/issues/2826) [PR #2827](https://github.com/PHPOffice/PhpSpreadsheet/pull/2827)
31+
- Null value handling in the Excel Math/Trig PRODUCT() function [Issue #2833](https://github.com/PHPOffice/PhpSpreadsheet/issues/2833) [PR #2834](https://github.com/PHPOffice/PhpSpreadsheet/pull/2834)
3132

3233

3334
## 1.23.0 - 2022-04-24

src/PhpSpreadsheet/Calculation/MathTrig/Operations.php

+1-1
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

+12
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)