From 66d9ae44dafe83ee7ddca8eaea23812783bc410d Mon Sep 17 00:00:00 2001 From: kit rio Date: Tue, 24 May 2022 17:09:13 +0900 Subject: [PATCH] =?UTF-8?q?PHP=208.0=EC=97=90=EC=84=9C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=EB=90=9C=20=EB=B0=B0=EC=97=B4=20=EC=9D=B8=EB=8D=B1?= =?UTF-8?q?=EC=8A=A4=20=ED=91=9C=EA=B8=B0=20{}=20->=20[]=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/PHPExcel/Calculation/FormulaParser.php | 58 +++++++++++----------- lib/PHPExcel/Reader/Excel5/Escher.php | 12 ++--- plugin/PHPMailer/extras/htmlfilter.php | 48 +++++++++--------- 3 files changed, 59 insertions(+), 59 deletions(-) diff --git a/lib/PHPExcel/Calculation/FormulaParser.php b/lib/PHPExcel/Calculation/FormulaParser.php index 03340e6998..111ccea81a 100644 --- a/lib/PHPExcel/Calculation/FormulaParser.php +++ b/lib/PHPExcel/Calculation/FormulaParser.php @@ -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 { @@ -191,7 +191,7 @@ private function parseToTokens() $value = ""; } } else { - $value .= $this->formula{$index}; + $value .= $this->formula[$index]; } ++$index; continue; @@ -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; @@ -219,10 +219,10 @@ 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; } @@ -230,7 +230,7 @@ private function parseToTokens() // 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 @@ 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; } @@ -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); @@ -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); @@ -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); @@ -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); @@ -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 = ""; @@ -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 = ""; @@ -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; @@ -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; @@ -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 = ""; @@ -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 = ""; @@ -460,7 +460,7 @@ private function parseToTokens() } // token accumulation - $value .= $this->formula{$index}; + $value .= $this->formula[$index]; ++$index; } diff --git a/lib/PHPExcel/Reader/Excel5/Escher.php b/lib/PHPExcel/Reader/Excel5/Escher.php index 2b99e22235..1f7f304f70 100644 --- a/lib/PHPExcel/Reader/Excel5/Escher.php +++ b/lib/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/plugin/PHPMailer/extras/htmlfilter.php b/plugin/PHPMailer/extras/htmlfilter.php index b4b2d878a2..1581c41013 100644 --- a/plugin/PHPMailer/extras/htmlfilter.php +++ b/plugin/PHPMailer/extras/htmlfilter.php @@ -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)" ); }