From 40edb8f1613f633120765aae01050cc26f82922e Mon Sep 17 00:00:00 2001 From: KONE SOREL Date: Fri, 27 Mar 2026 20:31:09 +0000 Subject: [PATCH] df --- PHPExcel/PHPExcel/Calculation.php | 36 +++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/PHPExcel/PHPExcel/Calculation.php b/PHPExcel/PHPExcel/Calculation.php index 20b1ec3..da16c68 100755 --- a/PHPExcel/PHPExcel/Calculation.php +++ b/PHPExcel/PHPExcel/Calculation.php @@ -2548,7 +2548,7 @@ class PHPExcel_Calculation public static function unwrapResult($value) { if (is_string($value)) { - if ((isset($value{0})) && ($value{0} == '"') && (substr($value, -1) == '"')) { + if ((isset($value[0])) && ($value[0] == '"') && (substr($value, -1) == '"')) { return substr($value, 1, -1); } // Convert numeric errors to NaN error @@ -2669,11 +2669,11 @@ class PHPExcel_Calculation // Basic validation that this is indeed a formula // We return an empty array if not $formula = trim($formula); - if ((!isset($formula{0})) || ($formula{0} != '=')) { + if ((!isset($formula[0])) || ($formula[0] != '=')) { return array(); } $formula = ltrim(substr($formula, 1)); - if (!isset($formula{0})) { + if (!isset($formula[0])) { return array(); } @@ -2761,11 +2761,11 @@ class PHPExcel_Calculation // Basic validation that this is indeed a formula // We simply return the cell value if not $formula = trim($formula); - if ($formula{0} != '=') { + if ($formula[0] != '=') { return self::wrapResult($formula); } $formula = ltrim(substr($formula, 1)); - if (!isset($formula{0})) { + if (!isset($formula[0])) { return self::wrapResult($formula); } @@ -2777,7 +2777,7 @@ class PHPExcel_Calculation return $cellValue; } - if (($wsTitle{0} !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) { + if (($wsTitle[0] !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) { if ($this->cyclicFormulaCount <= 0) { $this->cyclicFormulaCell = ''; return $this->raiseFormulaError('Cyclic Reference in Formula'); @@ -3031,7 +3031,7 @@ class PHPExcel_Calculation } else { if ($value == '') { return 'an empty string'; - } elseif ($value{0} == '#') { + } elseif ($value[0] == '#') { return 'a '.$value.' error'; } else { $typeString = 'a string'; @@ -3163,10 +3163,10 @@ class PHPExcel_Calculation // Loop through the formula extracting each operator and operand in turn while (true) { //echo 'Assessing Expression '.substr($formula, $index), PHP_EOL; - $opCharacter = $formula{$index}; // Get the first character of the value at the current index position + $opCharacter = $formula[$index]; // Get the first character of the value at the current index position //echo 'Initial character of expression block is '.$opCharacter, PHP_EOL; - if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula{$index+1}]))) { - $opCharacter .= $formula{++$index}; + if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula[$index+1]]))) { + $opCharacter .= $formula[++$index+1]; //echo 'Initial character of expression block is comparison operator '.$opCharacter.PHP_EOL; } @@ -3454,11 +3454,11 @@ class PHPExcel_Calculation } } // Ignore white space - while (($formula{$index} == "\n") || ($formula{$index} == "\r")) { + while (($formula[$index] == "\n") || ($formula[$index] == "\r")) { ++$index; } - if ($formula{$index} == ' ') { - while ($formula{$index} == ' ') { + if ($formula[$index] == ' ') { + while ($formula[$index] == ' ') { ++$index; } // If we're expecting an operator, but only have a space between the previous and next operands (and both are @@ -3888,7 +3888,7 @@ class PHPExcel_Calculation // echo 'Token is a PHPExcel constant: '.$excelConstant.'
'; $stack->push('Constant Value', self::$excelConstants[$excelConstant]); $this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->showTypeDetails(self::$excelConstants[$excelConstant])); - } elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) { + } elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token[0] == '"') || ($token[0] == '#')) { // echo 'Token is a number, boolean, string, null or an Excel error
'; $stack->push('Value', $token); // if the token is a named range, push the named range name onto the stack @@ -3933,13 +3933,13 @@ class PHPExcel_Calculation if (is_string($operand)) { // We only need special validations for the operand if it is a string // Start by stripping off the quotation marks we use to identify true excel string values internally - if ($operand > '' && $operand{0} == '"') { + if ($operand > '' && $operand[0] == '"') { $operand = self::unwrapResult($operand); } // If the string is a numeric value, we treat it as a numeric, so no further testing if (!is_numeric($operand)) { // If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations - if ($operand > '' && $operand{0} == '#') { + if ($operand > '' && $operand[0] == '#') { $stack->push('Value', $operand); $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand)); return false; @@ -3995,10 +3995,10 @@ class PHPExcel_Calculation } // Simple validate the two operands if they are string values - if (is_string($operand1) && $operand1 > '' && $operand1{0} == '"') { + if (is_string($operand1) && $operand1 > '' && $operand1[0] == '"') { $operand1 = self::unwrapResult($operand1); } - if (is_string($operand2) && $operand2 > '' && $operand2{0} == '"') { + if (is_string($operand2) && $operand2 > '' && $operand2[0] == '"') { $operand2 = self::unwrapResult($operand2); }