From 1b4098da8ee48aefc4afaf46aa51bd595cc5a570 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Wed, 30 Oct 2019 20:30:52 +0100 Subject: [PATCH] Minor scrutinizer fixes (#1226) * Minor scrutinizer fixes * Remove spurious debug output --- src/PhpSpreadsheet/Calculation/Calculation.php | 4 ++-- src/PhpSpreadsheet/Calculation/TextData.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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) {