From 82b9e0295a8172e1d56b30ba701a48b6e8a1e49d Mon Sep 17 00:00:00 2001 From: Dave Umrysh Date: Tue, 7 Mar 2023 11:21:52 -0700 Subject: [PATCH] PHP 8 fix for #Value! --- PHPExcel/Calculation.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/PHPExcel/Calculation.php b/PHPExcel/Calculation.php index fe62d14..b5d5591 100644 --- a/PHPExcel/Calculation.php +++ b/PHPExcel/Calculation.php @@ -3440,7 +3440,22 @@ class PHPExcel_Calculation { $arg = PHPExcel_Calculation_Functions::flattenSingleValue($arg); } unset($arg); - $result = call_user_func_array($functionCall,$args); + + // Remove the non-values + if(is_array($args)){ + $args = array_diff($args, array("#VALUE!")); + if (count($args) === 0) { + $result = ""; + }else{ + $result = call_user_func_array($functionCall,$args); + } + }else{ + if($args == "#VALUE!"){ + $result = ""; + }else{ + $result = call_user_func_array($functionCall,$args); + } + } } // } if ($functionName != 'MKMATRIX') {