Skip to content

Commit

Permalink
Merge pull request #2 from kasko/_PLAT-2145_deprecations_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JanisDavidsons authored May 23, 2023
2 parents 87b9ae9 + 12388dd commit 30f1af3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions src/PhpSpreadsheet/Calculation/Calculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4241,7 +4241,7 @@ private static function dataTestReference(&$operandData)
$rowKey = array_shift($rKeys);
$cKeys = array_keys(array_keys($operand[$rowKey]));
$colKey = array_shift($cKeys);
if (ctype_upper($colKey)) {
if (ctype_upper("$colKey")) {
$operandData['reference'] = $colKey . $rowKey;
}
}
Expand Down Expand Up @@ -4350,7 +4350,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $pCell = null)
}

// if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack
if (isset(self::$binaryOperators[$token])) {
if (isset(self::$binaryOperators["$token"])) {
// We must have two operands, error if we don't
if (($operand2Data = $stack->pop()) === null) {
return $this->raiseFormulaError('Internal error - Operand value missing from stack');
Expand Down Expand Up @@ -4561,7 +4561,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $pCell = null)
} else {
$this->executeNumericBinaryOperation($multiplier, $arg, '*', 'arrayTimesEquals', $stack);
}
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', $token, $matches)) {
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_CELLREF . '$/i', "$token", $matches)) {
$cellRef = null;
if (isset($matches[8])) {
if ($pCell === null) {
Expand Down Expand Up @@ -4636,7 +4636,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $pCell = null)
}

// if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/miu', $token, $matches)) {
} elseif (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/miu', "$token", $matches)) {
if ($pCellParent) {
$pCell->attach($pCellParent);
}
Expand Down Expand Up @@ -4723,7 +4723,7 @@ private function processTokenStack($tokens, $cellID = null, ?Cell $pCell = null)
}
} else {
// if the token is a number, boolean, string or an Excel error, push it onto the stack
if (isset(self::$excelConstants[strtoupper($token)])) {
if (isset(self::$excelConstants[strtoupper($token ?? '')])) {
$excelConstant = strtoupper($token);
$stack->push('Constant Value', self::$excelConstants[$excelConstant]);
if (isset($storeKey)) {
Expand Down Expand Up @@ -4897,7 +4897,7 @@ private function executeBinaryComparisonOperation($cellID, $operand1, $operand2,
if (is_numeric($operand1) && is_numeric($operand2)) {
$result = (abs($operand1 - $operand2) < $this->delta);
} else {
$result = strcmp($operand1, $operand2) == 0;
$result = strcmp("$operand1", "$operand2") == 0;
}

break;
Expand All @@ -4908,7 +4908,7 @@ private function executeBinaryComparisonOperation($cellID, $operand1, $operand2,
} elseif ($useLowercaseFirstComparison) {
$result = $this->strcmpLowercaseFirst($operand1, $operand2) >= 0;
} else {
$result = strcmp($operand1, $operand2) >= 0;
$result = strcmp("$operand1", "$operand2") >= 0;
}

break;
Expand All @@ -4919,7 +4919,7 @@ private function executeBinaryComparisonOperation($cellID, $operand1, $operand2,
} elseif ($useLowercaseFirstComparison) {
$result = $this->strcmpLowercaseFirst($operand1, $operand2) <= 0;
} else {
$result = strcmp($operand1, $operand2) <= 0;
$result = strcmp("$operand1", $operand2) <= 0;
}

break;
Expand Down
2 changes: 1 addition & 1 deletion src/PhpSpreadsheet/Calculation/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public static function ifCondition($condition)

if (!is_string($condition) || !in_array($condition[0], ['>', '<', '='])) {
if (!is_numeric($condition)) {
$condition = Calculation::wrapResult(strtoupper($condition));
$condition = Calculation::wrapResult(strtoupper("$condition"));
}

return str_replace('""""', '""', '=' . $condition);
Expand Down
4 changes: 2 additions & 2 deletions src/PhpSpreadsheet/Shared/StringHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public static function convertEncoding($value, $to, $from)
*/
public static function countCharacters($value, $enc = 'UTF-8')
{
return mb_strlen($value, $enc);
return mb_strlen("$value", $enc);
}

/**
Expand Down Expand Up @@ -502,7 +502,7 @@ public static function strToUpper($pValue)
*/
public static function strToLower($pValue)
{
return mb_convert_case($pValue, MB_CASE_LOWER, 'UTF-8');
return mb_convert_case("$pValue", MB_CASE_LOWER, 'UTF-8');
}

/**
Expand Down

0 comments on commit 30f1af3

Please sign in to comment.