From 706171da690c710dbefaaf57aa56e76a41bd1ba3 Mon Sep 17 00:00:00 2001 From: Ahmad Masabni Date: Fri, 23 Dec 2022 18:11:26 +0300 Subject: [PATCH] SD-83517 | Replace Array and String offset access from curly to square brackets --- Classes/PHPExcel/Calculation.php | 12 ++++++------ Classes/PHPExcel/Reader/Excel5.php | 12 ++++++------ Classes/PHPExcel/Reader/Excel5/Escher.php | 12 ++++++------ Classes/PHPExcel/Reader/SYLK.php | 4 ++-- Classes/PHPExcel/Shared/OLE.php | 2 +- Classes/PHPExcel/Shared/String.php | 8 ++++---- Classes/PHPExcel/Writer/Excel5/Parser.php | 2 +- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Classes/PHPExcel/Calculation.php b/Classes/PHPExcel/Calculation.php index 25ecf12ca..e04c1886e 100644 --- a/Classes/PHPExcel/Calculation.php +++ b/Classes/PHPExcel/Calculation.php @@ -3163,10 +3163,10 @@ private function _parseFormula($formula, PHPExcel_Cell $pCell = null) // 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]; //echo 'Initial character of expression block is comparison operator '.$opCharacter.PHP_EOL; } @@ -3454,11 +3454,11 @@ private function _parseFormula($formula, PHPExcel_Cell $pCell = null) } } // 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 diff --git a/Classes/PHPExcel/Reader/Excel5.php b/Classes/PHPExcel/Reader/Excel5.php index 813d47015..1f6a828bd 100644 --- a/Classes/PHPExcel/Reader/Excel5.php +++ b/Classes/PHPExcel/Reader/Excel5.php @@ -1988,7 +1988,7 @@ private function readFont() } // offset: 10; size: 1; underline type - $underlineType = ord($recordData{10}); + $underlineType = ord($recordData[10]); switch ($underlineType) { case 0x00: break; // no underline @@ -2888,7 +2888,7 @@ private function readSst() $pos += 2; // option flags - $optionFlags = ord($recordData{$pos}); + $optionFlags = ord($recordData[$pos]); ++$pos; // bit: 0; mask: 0x01; 0 = compressed; 1 = uncompressed @@ -2955,7 +2955,7 @@ private function readSst() // repeated option flags // OpenOffice.org documentation 5.21 - $option = ord($recordData{$pos}); + $option = ord($recordData[$pos]); ++$pos; if ($isCompressed && ($option == 0)) { @@ -2977,7 +2977,7 @@ private function readSst() // this fragment compressed $len = min($charsLeft, $limitpos - $pos); for ($j = 0; $j < $len; ++$j) { - $retstr .= $recordData{$pos + $j} . chr(0); + $retstr .= $recordData[$pos + $j] . chr(0); } $charsLeft -= $len; $isCompressed = false; @@ -4598,9 +4598,9 @@ private function readHyperLink() $hyperlinkType = 'UNC'; } elseif (!$isFileLinkOrUrl) { $hyperlinkType = 'workbook'; - } elseif (ord($recordData{$offset}) == 0x03) { + } elseif (ord($recordData[$offset]) == 0x03) { $hyperlinkType = 'local'; - } elseif (ord($recordData{$offset}) == 0xE0) { + } elseif (ord($recordData[$offset]) == 0xE0) { $hyperlinkType = 'URL'; } diff --git a/Classes/PHPExcel/Reader/Excel5/Escher.php b/Classes/PHPExcel/Reader/Excel5/Escher.php index 2b99e2223..1f7f304f7 100644 --- a/Classes/PHPExcel/Reader/Excel5/Escher.php +++ b/Classes/PHPExcel/Reader/Excel5/Escher.php @@ -280,16 +280,16 @@ private function readBSE() $foDelay = PHPExcel_Reader_Excel5::getInt4d($recordData, 28); // offset: 32; size: 1; unused1 - $unused1 = ord($recordData{32}); + $unused1 = ord($recordData[32]); // offset: 33; size: 1; size of nameData in bytes (including null terminator) - $cbName = ord($recordData{33}); + $cbName = ord($recordData[33]); // offset: 34; size: 1; unused2 - $unused2 = ord($recordData{34}); + $unused2 = ord($recordData[34]); // offset: 35; size: 1; unused3 - $unused3 = ord($recordData{35}); + $unused3 = ord($recordData[35]); // offset: 36; size: $cbName; nameData $nameData = substr($recordData, 36, $cbName); @@ -331,7 +331,7 @@ private function readBlipJPEG() } // offset: var; size: 1; tag - $tag = ord($recordData{$pos}); + $tag = ord($recordData[$pos]); $pos += 1; // offset: var; size: var; the raw image data @@ -372,7 +372,7 @@ private function readBlipPNG() } // offset: var; size: 1; tag - $tag = ord($recordData{$pos}); + $tag = ord($recordData[$pos]); $pos += 1; // offset: var; size: var; the raw image data diff --git a/Classes/PHPExcel/Reader/SYLK.php b/Classes/PHPExcel/Reader/SYLK.php index a8c6148c2..e232be65e 100644 --- a/Classes/PHPExcel/Reader/SYLK.php +++ b/Classes/PHPExcel/Reader/SYLK.php @@ -263,7 +263,7 @@ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) case 'S': $styleSettings = substr($rowDatum, 1); for ($i=0; $i