Skip to content

Commit

Permalink
PHP 8.0에서 삭제된 배열 인덱스 표기 {} -> [] 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
kitrio committed May 24, 2022
1 parent a19282b commit 66d9ae4
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 59 deletions.
58 changes: 29 additions & 29 deletions lib/PHPExcel/Calculation/FormulaParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ private function parseToTokens()
// embeds are doubled
// end marks token
if ($inString) {
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE)) {
if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
if ((($index + 2) <= $formulaLength) && ($this->formula[$index + 1] == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE)) {
$value .= PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE;
++$index;
} else {
Expand All @@ -191,7 +191,7 @@ private function parseToTokens()
$value = "";
}
} else {
$value .= $this->formula{$index};
$value .= $this->formula[$index];
}
++$index;
continue;
Expand All @@ -201,15 +201,15 @@ private function parseToTokens()
// embeds are double
// end does not mark a token
if ($inPath) {
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE)) {
if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
if ((($index + 2) <= $formulaLength) && ($this->formula[$index + 1] == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE)) {
$value .= PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE;
++$index;
} else {
$inPath = false;
}
} else {
$value .= $this->formula{$index};
$value .= $this->formula[$index];
}
++$index;
continue;
Expand All @@ -219,18 +219,18 @@ private function parseToTokens()
// no embeds (changed to "()" by Excel)
// end does not mark a token
if ($inRange) {
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_CLOSE) {
if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::BRACKET_CLOSE) {
$inRange = false;
}
$value .= $this->formula{$index};
$value .= $this->formula[$index];
++$index;
continue;
}

// error values
// end marks a token, determined from absolute list of values
if ($inError) {
$value .= $this->formula{$index};
$value .= $this->formula[$index];
++$index;
if (in_array($value, $ERRORS)) {
$inError = false;
Expand All @@ -241,10 +241,10 @@ private function parseToTokens()
}

// scientific notation check
if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_SN, $this->formula{$index}) !== false) {
if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_SN, $this->formula[$index]) !== false) {
if (strlen($value) > 1) {
if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula{$index}) != 0) {
$value .= $this->formula{$index};
if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula[$index]) != 0) {
$value .= $this->formula[$index];
++$index;
continue;
}
Expand All @@ -254,7 +254,7 @@ private function parseToTokens()
// independent character evaluation (order not important)

// establish state-dependent character evaluations
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
if (strlen($value > 0)) {
// unexpected
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
Expand All @@ -265,7 +265,7 @@ private function parseToTokens()
continue;
}

if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
if (strlen($value) > 0) {
// unexpected
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
Expand All @@ -276,14 +276,14 @@ private function parseToTokens()
continue;
}

if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_OPEN) {
if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::BRACKET_OPEN) {
$inRange = true;
$value .= PHPExcel_Calculation_FormulaParser::BRACKET_OPEN;
++$index;
continue;
}

if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::ERROR_START) {
if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::ERROR_START) {
if (strlen($value) > 0) {
// unexpected
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
Expand All @@ -296,7 +296,7 @@ private function parseToTokens()
}

// mark start and end of arrays and array rows
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_OPEN) {
if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::BRACE_OPEN) {
if (strlen($value) > 0) {
// unexpected
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
Expand All @@ -315,7 +315,7 @@ private function parseToTokens()
continue;
}

if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::SEMICOLON) {
if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::SEMICOLON) {
if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
$value = "";
Expand All @@ -337,7 +337,7 @@ private function parseToTokens()
continue;
}

if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_CLOSE) {
if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::BRACE_CLOSE) {
if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
$value = "";
Expand All @@ -358,14 +358,14 @@ private function parseToTokens()
}

// trim white-space
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) {
if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::WHITESPACE) {
if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
$value = "";
}
$tokens1[] = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE);
++$index;
while (($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) && ($index < $formulaLength)) {
while (($this->formula[$index] == PHPExcel_Calculation_FormulaParser::WHITESPACE) && ($index < $formulaLength)) {
++$index;
}
continue;
Expand All @@ -385,29 +385,29 @@ private function parseToTokens()
}

// standard infix operators
if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_INFIX, $this->formula{$index}) !== false) {
if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_INFIX, $this->formula[$index]) !== false) {
if (strlen($value) > 0) {
$tokens1[] =new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
$value = "";
}
$tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX);
$tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula[$index], PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX);
++$index;
continue;
}

// standard postfix operators (only one)
if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_POSTFIX, $this->formula{$index}) !== false) {
if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_POSTFIX, $this->formula[$index]) !== false) {
if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
$value = "";
}
$tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX);
$tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula[$index], PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX);
++$index;
continue;
}

// start subexpression or function
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_OPEN) {
if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::PAREN_OPEN) {
if (strlen($value) > 0) {
$tmp = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
$tokens1[] = $tmp;
Expand All @@ -423,7 +423,7 @@ private function parseToTokens()
}

// function, subexpression, or array parameters, or operand unions
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::COMMA) {
if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::COMMA) {
if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
$value = "";
Expand All @@ -444,7 +444,7 @@ private function parseToTokens()
}

// stop subexpression
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_CLOSE) {
if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::PAREN_CLOSE) {
if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
$value = "";
Expand All @@ -460,7 +460,7 @@ private function parseToTokens()
}

// token accumulation
$value .= $this->formula{$index};
$value .= $this->formula[$index];
++$index;
}

Expand Down
12 changes: 6 additions & 6 deletions lib/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

0 comments on commit 66d9ae4

Please sign in to comment.