Skip to content

Commit

Permalink
Merge pull request #2 from useinsider/feature/SD-83517
Browse files Browse the repository at this point in the history
SD-83517 | Replace Array and String offset access from curly to square brackets
  • Loading branch information
masabni authored Dec 23, 2022
2 parents 6eec054 + 706171d commit 75362c3
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions Classes/PHPExcel/Calculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions Classes/PHPExcel/Reader/Excel5.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)) {
Expand All @@ -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;
Expand Down Expand Up @@ -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';
}

Expand Down
12 changes: 6 additions & 6 deletions Classes/PHPExcel/Reader/Excel5/Escher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Classes/PHPExcel/Reader/SYLK.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
case 'S':
$styleSettings = substr($rowDatum, 1);
for ($i=0; $i<strlen($styleSettings); ++$i) {
switch ($styleSettings{$i}) {
switch ($styleSettings[$i]) {
case 'I':
$formatArray['font']['italic'] = true;
break;
Expand Down Expand Up @@ -384,7 +384,7 @@ public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
case 'S':
$styleSettings = substr($rowDatum, 1);
for ($i=0; $i<strlen($styleSettings); ++$i) {
switch ($styleSettings{$i}) {
switch ($styleSettings[$i]) {
case 'I':
$styleData['font']['italic'] = true;
break;
Expand Down
2 changes: 1 addition & 1 deletion Classes/PHPExcel/Shared/OLE.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ public static function Asc2Ucs($ascii)
{
$rawname = '';
for ($i = 0; $i < strlen($ascii); ++$i) {
$rawname .= $ascii{$i} . "\x00";
$rawname .= $ascii[$i] . "\x00";
}
return $rawname;
}
Expand Down
8 changes: 4 additions & 4 deletions Classes/PHPExcel/Shared/String.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,11 @@ public static function utf16_decode($str, $bom_be = true)
$newstr = '';
for ($i=0; $i<$len; $i+=2) {
if ($bom_be) {
$val = ord($str{$i}) << 4;
$val += ord($str{$i+1});
$val = ord($str[$i]) << 4;
$val += ord($str[$i+1]);
} else {
$val = ord($str{$i+1}) << 4;
$val += ord($str{$i});
$val = ord($str[$i+1]) << 4;
$val += ord($str[$i]);
}
$newstr .= ($val == 0x228) ? "\n" : chr($val);
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/PHPExcel/Writer/Excel5/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ private function cellToRowcol($cell)
$col = 0;
$col_ref_length = strlen($col_ref);
for ($i = 0; $i < $col_ref_length; ++$i) {
$col += (ord($col_ref{$i}) - 64) * pow(26, $expn);
$col += (ord($col_ref[$i]) - 64) * pow(26, $expn);
--$expn;
}

Expand Down

0 comments on commit 75362c3

Please sign in to comment.