PHP 8.0에서 삭제된 배열 인덱스 표기 {} -> [] 수정
This commit is contained in:
@ -181,8 +181,8 @@ class PHPExcel_Calculation_FormulaParser
|
||||
// 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 {
|
||||
@ -191,7 +191,7 @@ class PHPExcel_Calculation_FormulaParser
|
||||
$value = "";
|
||||
}
|
||||
} else {
|
||||
$value .= $this->formula{$index};
|
||||
$value .= $this->formula[$index];
|
||||
}
|
||||
++$index;
|
||||
continue;
|
||||
@ -201,15 +201,15 @@ class PHPExcel_Calculation_FormulaParser
|
||||
// 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;
|
||||
@ -219,10 +219,10 @@ class PHPExcel_Calculation_FormulaParser
|
||||
// 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;
|
||||
}
|
||||
@ -230,7 +230,7 @@ class PHPExcel_Calculation_FormulaParser
|
||||
// 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;
|
||||
@ -241,10 +241,10 @@ class PHPExcel_Calculation_FormulaParser
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
@ -254,7 +254,7 @@ class PHPExcel_Calculation_FormulaParser
|
||||
// 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);
|
||||
@ -265,7 +265,7 @@ class PHPExcel_Calculation_FormulaParser
|
||||
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);
|
||||
@ -276,14 +276,14 @@ class PHPExcel_Calculation_FormulaParser
|
||||
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);
|
||||
@ -296,7 +296,7 @@ class PHPExcel_Calculation_FormulaParser
|
||||
}
|
||||
|
||||
// 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);
|
||||
@ -315,7 +315,7 @@ class PHPExcel_Calculation_FormulaParser
|
||||
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 = "";
|
||||
@ -337,7 +337,7 @@ class PHPExcel_Calculation_FormulaParser
|
||||
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 = "";
|
||||
@ -358,14 +358,14 @@ class PHPExcel_Calculation_FormulaParser
|
||||
}
|
||||
|
||||
// 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;
|
||||
@ -385,29 +385,29 @@ class PHPExcel_Calculation_FormulaParser
|
||||
}
|
||||
|
||||
// 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;
|
||||
@ -423,7 +423,7 @@ class PHPExcel_Calculation_FormulaParser
|
||||
}
|
||||
|
||||
// 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 = "";
|
||||
@ -444,7 +444,7 @@ class PHPExcel_Calculation_FormulaParser
|
||||
}
|
||||
|
||||
// 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 = "";
|
||||
@ -460,7 +460,7 @@ class PHPExcel_Calculation_FormulaParser
|
||||
}
|
||||
|
||||
// token accumulation
|
||||
$value .= $this->formula{$index};
|
||||
$value .= $this->formula[$index];
|
||||
++$index;
|
||||
}
|
||||
|
||||
|
||||
@ -280,16 +280,16 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
$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 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
}
|
||||
|
||||
// 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 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
}
|
||||
|
||||
// offset: var; size: 1; tag
|
||||
$tag = ord($recordData{$pos});
|
||||
$tag = ord($recordData[$pos]);
|
||||
$pos += 1;
|
||||
|
||||
// offset: var; size: var; the raw image data
|
||||
|
||||
@ -348,7 +348,7 @@ function tln_getnxtag($body, $offset)
|
||||
}
|
||||
//intentional fall-through
|
||||
case '>':
|
||||
$attary{$attname} = '"yes"';
|
||||
$attary[$attname] = '"yes"';
|
||||
return array($tagname, $attary, $tagtype, $lt, $pos);
|
||||
break;
|
||||
default:
|
||||
@ -382,7 +382,7 @@ function tln_getnxtag($body, $offset)
|
||||
}
|
||||
list($pos, $attval, $match) = $regary;
|
||||
$pos++;
|
||||
$attary{$attname} = '\'' . $attval . '\'';
|
||||
$attary[$attname] = '\'' . $attval . '\'';
|
||||
} elseif ($quot == '"') {
|
||||
$regary = tln_findnxreg($body, $pos + 1, '\"');
|
||||
if ($regary == false) {
|
||||
@ -390,7 +390,7 @@ function tln_getnxtag($body, $offset)
|
||||
}
|
||||
list($pos, $attval, $match) = $regary;
|
||||
$pos++;
|
||||
$attary{$attname} = '"' . $attval . '"';
|
||||
$attary[$attname] = '"' . $attval . '"';
|
||||
} else {
|
||||
/**
|
||||
* These are hateful. Look for \s, or >.
|
||||
@ -404,13 +404,13 @@ function tln_getnxtag($body, $offset)
|
||||
* If it's ">" it will be caught at the top.
|
||||
*/
|
||||
$attval = preg_replace('/\"/s', '"', $attval);
|
||||
$attary{$attname} = '"' . $attval . '"';
|
||||
$attary[$attname] = '"' . $attval . '"';
|
||||
}
|
||||
} elseif (preg_match('|[\w/>]|', $char)) {
|
||||
/**
|
||||
* That was attribute type 4.
|
||||
*/
|
||||
$attary{$attname} = '"yes"';
|
||||
$attary[$attname] = '"yes"';
|
||||
} else {
|
||||
/**
|
||||
* An illegal character. Find next '>' and return.
|
||||
@ -446,7 +446,7 @@ function tln_deent(&$attvalue, $regex, $hex = false)
|
||||
if ($hex) {
|
||||
$numval = hexdec($numval);
|
||||
}
|
||||
$repl{$matches[0][$i]} = chr($numval);
|
||||
$repl[$matches[0][$i]] = chr($numval);
|
||||
}
|
||||
$attvalue = strtr($attvalue, $repl);
|
||||
return true;
|
||||
@ -528,7 +528,7 @@ function tln_fixatts(
|
||||
if (preg_match($matchtag, $tagname)) {
|
||||
foreach ($matchattrs as $matchattr) {
|
||||
if (preg_match($matchattr, $attname)) {
|
||||
unset($attary{$attname});
|
||||
unset($attary[$attname]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -541,7 +541,7 @@ function tln_fixatts(
|
||||
tln_defang($attvalue);
|
||||
if ($attname == 'style' && $attvalue !== $oldattvalue) {
|
||||
$attvalue = "idiocy";
|
||||
$attary{$attname} = $attvalue;
|
||||
$attary[$attname] = $attvalue;
|
||||
}
|
||||
tln_unspace($attvalue);
|
||||
|
||||
@ -563,7 +563,7 @@ function tln_fixatts(
|
||||
list($valmatch, $valrepl) = $valary;
|
||||
$newvalue = preg_replace($valmatch, $valrepl, $attvalue);
|
||||
if ($newvalue != $attvalue) {
|
||||
$attary{$attname} = $newvalue;
|
||||
$attary[$attname] = $newvalue;
|
||||
$attvalue = $newvalue;
|
||||
}
|
||||
}
|
||||
@ -572,14 +572,14 @@ function tln_fixatts(
|
||||
}
|
||||
if ($attname == 'style') {
|
||||
if (preg_match('/[\0-\37\200-\377]+/', $attvalue)) {
|
||||
$attary{$attname} = '"disallowed character"';
|
||||
$attary[$attname] = '"disallowed character"';
|
||||
}
|
||||
preg_match_all("/url\s*\((.+)\)/si", $attvalue, $aMatch);
|
||||
if (count($aMatch)) {
|
||||
foreach($aMatch[1] as $sMatch) {
|
||||
$urlvalue = $sMatch;
|
||||
tln_fixurl($attname, $urlvalue, $trans_image_path, $block_external_images);
|
||||
$attary{$attname} = str_replace($sMatch, $urlvalue, $attvalue);
|
||||
$attary[$attname] = str_replace($sMatch, $urlvalue, $attvalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -671,7 +671,7 @@ function tln_fixstyle($body, $pos, $trans_image_path, $block_external_images)
|
||||
$bSucces = false;
|
||||
$bEndTag = false;
|
||||
for ($i=$pos,$iCount=strlen($body);$i<$iCount;++$i) {
|
||||
$char = $body{$i};
|
||||
$char = $body[$i];
|
||||
switch ($char) {
|
||||
case '<':
|
||||
$sToken = $char;
|
||||
@ -702,7 +702,7 @@ function tln_fixstyle($body, $pos, $trans_image_path, $block_external_images)
|
||||
case '!':
|
||||
if ($sToken == '<') {
|
||||
// possible comment
|
||||
if (isset($body{$i+2}) && substr($body,$i,3) == '!--') {
|
||||
if (isset($body[$i+2]) && substr($body,$i,3) == '!--') {
|
||||
$i = strpos($body,'-->',$i+3);
|
||||
if ($i === false) { // no end comment
|
||||
$i = strlen($body);
|
||||
@ -818,7 +818,7 @@ function tln_body2div($attary, $trans_image_path)
|
||||
$styledef .= "color: $text; ";
|
||||
}
|
||||
if (strlen($styledef) > 0){
|
||||
$divattary{"style"} = "\"$styledef\"";
|
||||
$divattary["style"] = "\"$styledef\"";
|
||||
}
|
||||
}
|
||||
return $divattary;
|
||||
@ -914,10 +914,10 @@ function tln_sanitize(
|
||||
if ($tagname == "body") {
|
||||
$tagname = "div";
|
||||
}
|
||||
if (isset($open_tags{$tagname}) &&
|
||||
$open_tags{$tagname} > 0
|
||||
if (isset($open_tags[$tagname]) &&
|
||||
$open_tags[$tagname] > 0
|
||||
) {
|
||||
$open_tags{$tagname}--;
|
||||
$open_tags[$tagname]--;
|
||||
} else {
|
||||
$tagname = false;
|
||||
}
|
||||
@ -961,10 +961,10 @@ function tln_sanitize(
|
||||
$attary = tln_body2div($attary, $trans_image_path);
|
||||
}
|
||||
if ($tagtype == 1) {
|
||||
if (isset($open_tags{$tagname})) {
|
||||
$open_tags{$tagname}++;
|
||||
if (isset($open_tags[$tagname])) {
|
||||
$open_tags[$tagname]++;
|
||||
} else {
|
||||
$open_tags{$tagname} = 1;
|
||||
$open_tags[$tagname] = 1;
|
||||
}
|
||||
}
|
||||
/**
|
||||
@ -1121,19 +1121,19 @@ function HTMLFilter($body, $trans_image_path, $block_external_images = false)
|
||||
|
||||
if ($block_external_images) {
|
||||
array_push(
|
||||
$bad_attvals{'/.*/'}{'/^src|background/i'}[0],
|
||||
$bad_attvals['/.*/']['/^src|background/i'][0],
|
||||
'/^([\'\"])\s*https*:.*([\'\"])/si'
|
||||
);
|
||||
array_push(
|
||||
$bad_attvals{'/.*/'}{'/^src|background/i'}[1],
|
||||
$bad_attvals['/.*/']['/^src|background/i'][1],
|
||||
"\\1$trans_image_path\\1"
|
||||
);
|
||||
array_push(
|
||||
$bad_attvals{'/.*/'}{'/^style/i'}[0],
|
||||
$bad_attvals['/.*/']['/^style/i'][0],
|
||||
'/url\(([\'\"])\s*https*:.*([\'\"])\)/si'
|
||||
);
|
||||
array_push(
|
||||
$bad_attvals{'/.*/'}{'/^style/i'}[1],
|
||||
$bad_attvals['/.*/']['/^style/i'][1],
|
||||
"url(\\1$trans_image_path\\1)"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user