diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 93d7058d..923b19e9 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -3658,8 +3658,8 @@ class Calculation $rangeWS2 = $rangeWS1; } $refSheet = $pCellParent; - if ($rangeSheetRef !== $pCellParent->getTitle()) { - $refSheet = $pCell->getWorksheet()->getParent()->getSheetByName($rangeSheetRef); + if ($pCellParent !== null && $rangeSheetRef !== $pCellParent->getTitle()) { + $refSheet = $pCellParent->getParent()->getSheetByName($rangeSheetRef); } if ((is_int($startRowColRef)) && (ctype_digit($val)) && ($startRowColRef <= 1048576) && ($val <= 1048576)) { diff --git a/src/PhpSpreadsheet/Calculation/TextData.php b/src/PhpSpreadsheet/Calculation/TextData.php index ea00ef1c..bbb03926 100644 --- a/src/PhpSpreadsheet/Calculation/TextData.php +++ b/src/PhpSpreadsheet/Calculation/TextData.php @@ -266,7 +266,7 @@ class TextData if (!is_numeric($value) || !is_numeric($decimals)) { return Functions::NAN(); } - $decimals = floor($decimals); + $decimals = (int) floor($decimals); $valueResult = round($value, $decimals); if ($decimals < 0) {