Browse Source

descontinuado acessar array por chaves -> deprecate_curly_braces_array_access - https://wiki.php.net/rfc/deprecate_curly_braces_array_access

1.8.1-monitor
bruno 1 year ago
parent
commit
c24bd26783
  1. 4
      asterisk/var_lib_asterisk/scripts/tarifador/php_serial.class.php
  2. 16
      include/Console/Getopt.php
  3. 36
      include/PHPExcel/Calculation.php
  4. 8
      include/PHPExcel/Calculation/Engineering.php
  5. 58
      include/PHPExcel/Calculation/FormulaParser.php
  6. 4
      include/PHPExcel/Calculation/Functions.php
  7. 4
      include/PHPExcel/Cell.php
  8. 4
      include/PHPExcel/Cell/DefaultValueBinder.php
  9. 94
      include/PHPExcel/Reader/Excel5.php
  10. 4
      include/PHPExcel/Reader/Excel5/Escher.php
  11. 16
      include/PHPExcel/Reader/SYLK.php
  12. 4
      include/PHPExcel/Shared/OLE.php
  13. 12
      include/PHPExcel/Shared/String.php
  14. 2
      include/PHPExcel/Shared/ZipStreamWrapper.php
  15. 14
      include/PHPExcel/Writer/Excel5/Parser.php
  16. 2
      include/PHPExcel/Writer/Excel5/Workbook.php
  17. 2
      include/PHPExcel/Writer/Excel5/Worksheet.php
  18. 58
      include/phpagi/phpagi.php
  19. 2
      include/securimage/WavFile.php
  20. 2
      include/securimage/securimage.php
  21. 2
      monitorAlgar/relatorioMonitoraAlgar.php

4
asterisk/var_lib_asterisk/scripts/tarifador/php_serial.class.php

@ -372,10 +372,10 @@ class phpSerial {
$return = exec("setserial " . $this->_device . " " . $param . " " . $arg . " 2>&1"); $return = exec("setserial " . $this->_device . " " . $param . " " . $arg . " 2>&1");
if ($return{0} === "I") { if ($return[0] === "I") {
trigger_error("setserial: Invalid flag", E_USER_WARNING); trigger_error("setserial: Invalid flag", E_USER_WARNING);
return false; return false;
} elseif ($return{0} === "/") { } elseif ($return[0] === "/") {
trigger_error("setserial: Error with device file", E_USER_WARNING); trigger_error("setserial: Error with device file", E_USER_WARNING);
return false; return false;
} else { } else {

16
include/Console/Getopt.php

@ -119,10 +119,10 @@ class Console_Getopt {
break; break;
} }
if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) { if ($arg[0] != '-' || (strlen($arg) > 1 && $arg[1] == '-' && !$long_options)) {
$non_opts = array_merge($non_opts, array_slice($args, $i)); $non_opts = array_merge($non_opts, array_slice($args, $i));
break; break;
} elseif (strlen($arg) > 1 && $arg{1} == '-') { } elseif (strlen($arg) > 1 && $arg[1] == '-') {
$error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args); $error = Console_Getopt::_parseLongOption(substr($arg, 2), $long_options, $opts, $args);
if (PEAR::isError($error)) if (PEAR::isError($error))
return $error; return $error;
@ -146,16 +146,16 @@ class Console_Getopt {
*/ */
function _parseShortOption($arg, $short_options, &$opts, &$args) { function _parseShortOption($arg, $short_options, &$opts, &$args) {
for ($i = 0; $i < strlen($arg); $i++) { for ($i = 0; $i < strlen($arg); $i++) {
$opt = $arg{$i}; $opt = $arg[$i];
$opt_arg = null; $opt_arg = null;
/* Try to find the short option in the specifier string. */ /* Try to find the short option in the specifier string. */
if (($spec = strstr($short_options, $opt)) === false || $arg{$i} == ':') { if (($spec = strstr($short_options, $opt)) === false || $arg[$i] == ':') {
return PEAR::raiseError("Console_Getopt: unrecognized option -- $opt"); return PEAR::raiseError("Console_Getopt: unrecognized option -- $opt");
} }
if (strlen($spec) > 1 && $spec{1} == ':') { if (strlen($spec) > 1 && $spec[1] == ':') {
if (strlen($spec) > 2 && $spec{2} == ':') { if (strlen($spec) > 2 && $spec[2] == ':') {
if ($i + 1 < strlen($arg)) { if ($i + 1 < strlen($arg)) {
/* Option takes an optional argument. Use the remainder of /* Option takes an optional argument. Use the remainder of
the arg string if there is anything left. */ the arg string if there is anything left. */
@ -227,11 +227,11 @@ class Console_Getopt {
} else { } else {
$next_option_rest = ''; $next_option_rest = '';
} }
if ($opt_rest != '' && $opt{0} != '=' && if ($opt_rest != '' && $opt[0] != '=' &&
$i + 1 < count($long_options) && $i + 1 < count($long_options) &&
$opt == substr($long_options[$i + 1], 0, $opt_len) && $opt == substr($long_options[$i + 1], 0, $opt_len) &&
$next_option_rest != '' && $next_option_rest != '' &&
$next_option_rest{0} != '=') { $next_option_rest[0] != '=') {
return PEAR::raiseError("Console_Getopt: option --$opt is ambiguous"); return PEAR::raiseError("Console_Getopt: option --$opt is ambiguous");
} }

36
include/PHPExcel/Calculation.php

@ -2548,7 +2548,7 @@ class PHPExcel_Calculation
public static function unwrapResult($value) public static function unwrapResult($value)
{ {
if (is_string($value)) { if (is_string($value)) {
if ((isset($value{0})) && ($value{0} == '"') && (substr($value, -1) == '"')) { if ((isset($value[0])) && ($value[0] == '"') && (substr($value, -1) == '"')) {
return substr($value, 1, -1); return substr($value, 1, -1);
} }
// Convert numeric errors to NaN error // Convert numeric errors to NaN error
@ -2669,11 +2669,11 @@ class PHPExcel_Calculation
// Basic validation that this is indeed a formula // Basic validation that this is indeed a formula
// We return an empty array if not // We return an empty array if not
$formula = trim($formula); $formula = trim($formula);
if ((!isset($formula{0})) || ($formula{0} != '=')) { if ((!isset($formula[0])) || ($formula[0] != '=')) {
return array(); return array();
} }
$formula = ltrim(substr($formula, 1)); $formula = ltrim(substr($formula, 1));
if (!isset($formula{0})) { if (!isset($formula[0])) {
return array(); return array();
} }
@ -2761,11 +2761,11 @@ class PHPExcel_Calculation
// Basic validation that this is indeed a formula // Basic validation that this is indeed a formula
// We simply return the cell value if not // We simply return the cell value if not
$formula = trim($formula); $formula = trim($formula);
if ($formula{0} != '=') { if ($formula[0] != '=') {
return self::wrapResult($formula); return self::wrapResult($formula);
} }
$formula = ltrim(substr($formula, 1)); $formula = ltrim(substr($formula, 1));
if (!isset($formula{0})) { if (!isset($formula[0])) {
return self::wrapResult($formula); return self::wrapResult($formula);
} }
@ -2777,7 +2777,7 @@ class PHPExcel_Calculation
return $cellValue; return $cellValue;
} }
if (($wsTitle{0} !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) { if (($wsTitle[0] !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) {
if ($this->cyclicFormulaCount <= 0) { if ($this->cyclicFormulaCount <= 0) {
$this->cyclicFormulaCell = ''; $this->cyclicFormulaCell = '';
return $this->raiseFormulaError('Cyclic Reference in Formula'); return $this->raiseFormulaError('Cyclic Reference in Formula');
@ -3031,7 +3031,7 @@ class PHPExcel_Calculation
} else { } else {
if ($value == '') { if ($value == '') {
return 'an empty string'; return 'an empty string';
} elseif ($value{0} == '#') { } elseif ($value[0] == '#') {
return 'a '.$value.' error'; return 'a '.$value.' error';
} else { } else {
$typeString = 'a string'; $typeString = 'a string';
@ -3163,10 +3163,10 @@ class PHPExcel_Calculation
// Loop through the formula extracting each operator and operand in turn // Loop through the formula extracting each operator and operand in turn
while (true) { while (true) {
//echo 'Assessing Expression '.substr($formula, $index), PHP_EOL; //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; //echo 'Initial character of expression block is '.$opCharacter, PHP_EOL;
if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula{$index+1}]))) { if ((isset(self::$comparisonOperators[$opCharacter])) && (strlen($formula) > $index) && (isset(self::$comparisonOperators[$formula[$index+1]]))) {
$opCharacter .= $formula{++$index}; $opCharacter .= $formula[++$index];
//echo 'Initial character of expression block is comparison operator '.$opCharacter.PHP_EOL; //echo 'Initial character of expression block is comparison operator '.$opCharacter.PHP_EOL;
} }
@ -3454,11 +3454,11 @@ class PHPExcel_Calculation
} }
} }
// Ignore white space // Ignore white space
while (($formula{$index} == "\n") || ($formula{$index} == "\r")) { while (($formula[$index] == "\n") || ($formula[$index] == "\r")) {
++$index; ++$index;
} }
if ($formula{$index} == ' ') { if ($formula[$index] == ' ') {
while ($formula{$index} == ' ') { while ($formula[$index] == ' ') {
++$index; ++$index;
} }
// If we're expecting an operator, but only have a space between the previous and next operands (and both are // If we're expecting an operator, but only have a space between the previous and next operands (and both are
@ -3888,7 +3888,7 @@ class PHPExcel_Calculation
// echo 'Token is a PHPExcel constant: '.$excelConstant.'<br />'; // echo 'Token is a PHPExcel constant: '.$excelConstant.'<br />';
$stack->push('Constant Value', self::$excelConstants[$excelConstant]); $stack->push('Constant Value', self::$excelConstants[$excelConstant]);
$this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->showTypeDetails(self::$excelConstants[$excelConstant])); $this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->showTypeDetails(self::$excelConstants[$excelConstant]));
} elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) { } elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token[0] == '"') || ($token[0] == '#')) {
// echo 'Token is a number, boolean, string, null or an Excel error<br />'; // echo 'Token is a number, boolean, string, null or an Excel error<br />';
$stack->push('Value', $token); $stack->push('Value', $token);
// if the token is a named range, push the named range name onto the stack // if the token is a named range, push the named range name onto the stack
@ -3933,13 +3933,13 @@ class PHPExcel_Calculation
if (is_string($operand)) { if (is_string($operand)) {
// We only need special validations for the operand if it is a string // We only need special validations for the operand if it is a string
// Start by stripping off the quotation marks we use to identify true excel string values internally // Start by stripping off the quotation marks we use to identify true excel string values internally
if ($operand > '' && $operand{0} == '"') { if ($operand > '' && $operand[0] == '"') {
$operand = self::unwrapResult($operand); $operand = self::unwrapResult($operand);
} }
// If the string is a numeric value, we treat it as a numeric, so no further testing // If the string is a numeric value, we treat it as a numeric, so no further testing
if (!is_numeric($operand)) { if (!is_numeric($operand)) {
// If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations // If not a numeric, test to see if the value is an Excel error, and so can't be used in normal binary operations
if ($operand > '' && $operand{0} == '#') { if ($operand > '' && $operand[0] == '#') {
$stack->push('Value', $operand); $stack->push('Value', $operand);
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand)); $this->_debugLog->writeDebugLog('Evaluation Result is ', $this->showTypeDetails($operand));
return false; return false;
@ -3995,10 +3995,10 @@ class PHPExcel_Calculation
} }
// Simple validate the two operands if they are string values // Simple validate the two operands if they are string values
if (is_string($operand1) && $operand1 > '' && $operand1{0} == '"') { if (is_string($operand1) && $operand1 > '' && $operand1[0] == '"') {
$operand1 = self::unwrapResult($operand1); $operand1 = self::unwrapResult($operand1);
} }
if (is_string($operand2) && $operand2 > '' && $operand2{0} == '"') { if (is_string($operand2) && $operand2 > '' && $operand2[0] == '"') {
$operand2 = self::unwrapResult($operand2); $operand2 = self::unwrapResult($operand2);
} }

8
include/PHPExcel/Calculation/Engineering.php

@ -809,16 +809,16 @@ class PHPExcel_Calculation_Engineering
*/ */
private static function cleanComplex($complexNumber) private static function cleanComplex($complexNumber)
{ {
if ($complexNumber{0} == '+') { if ($complexNumber[0] == '+') {
$complexNumber = substr($complexNumber, 1); $complexNumber = substr($complexNumber, 1);
} }
if ($complexNumber{0} == '0') { if ($complexNumber[0] == '0') {
$complexNumber = substr($complexNumber, 1); $complexNumber = substr($complexNumber, 1);
} }
if ($complexNumber{0} == '.') { if ($complexNumber[0] == '.') {
$complexNumber = '0'.$complexNumber; $complexNumber = '0'.$complexNumber;
} }
if ($complexNumber{0} == '+') { if ($complexNumber[0] == '+') {
$complexNumber = substr($complexNumber, 1); $complexNumber = substr($complexNumber, 1);
} }
return $complexNumber; return $complexNumber;

58
include/PHPExcel/Calculation/FormulaParser.php

@ -181,8 +181,8 @@ class PHPExcel_Calculation_FormulaParser
// embeds are doubled // embeds are doubled
// end marks token // end marks token
if ($inString) { if ($inString) {
if ($this->formula{$index} == 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)) { if ((($index + 2) <= $formulaLength) && ($this->formula[$index + 1] == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE)) {
$value .= PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE; $value .= PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE;
++$index; ++$index;
} else { } else {
@ -191,7 +191,7 @@ class PHPExcel_Calculation_FormulaParser
$value = ""; $value = "";
} }
} else { } else {
$value .= $this->formula{$index}; $value .= $this->formula[$index];
} }
++$index; ++$index;
continue; continue;
@ -201,15 +201,15 @@ class PHPExcel_Calculation_FormulaParser
// embeds are double // embeds are double
// end does not mark a token // end does not mark a token
if ($inPath) { if ($inPath) {
if ($this->formula{$index} == 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)) { if ((($index + 2) <= $formulaLength) && ($this->formula[$index + 1] == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE)) {
$value .= PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE; $value .= PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE;
++$index; ++$index;
} else { } else {
$inPath = false; $inPath = false;
} }
} else { } else {
$value .= $this->formula{$index}; $value .= $this->formula[$index];
} }
++$index; ++$index;
continue; continue;
@ -219,10 +219,10 @@ class PHPExcel_Calculation_FormulaParser
// no embeds (changed to "()" by Excel) // no embeds (changed to "()" by Excel)
// end does not mark a token // end does not mark a token
if ($inRange) { if ($inRange) {
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_CLOSE) { if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::BRACKET_CLOSE) {
$inRange = false; $inRange = false;
} }
$value .= $this->formula{$index}; $value .= $this->formula[$index];
++$index; ++$index;
continue; continue;
} }
@ -230,7 +230,7 @@ class PHPExcel_Calculation_FormulaParser
// error values // error values
// end marks a token, determined from absolute list of values // end marks a token, determined from absolute list of values
if ($inError) { if ($inError) {
$value .= $this->formula{$index}; $value .= $this->formula[$index];
++$index; ++$index;
if (in_array($value, $ERRORS)) { if (in_array($value, $ERRORS)) {
$inError = false; $inError = false;
@ -241,10 +241,10 @@ class PHPExcel_Calculation_FormulaParser
} }
// scientific notation check // 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 (strlen($value) > 1) {
if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula{$index}) != 0) { if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula[$index]) != 0) {
$value .= $this->formula{$index}; $value .= $this->formula[$index];
++$index; ++$index;
continue; continue;
} }
@ -254,7 +254,7 @@ class PHPExcel_Calculation_FormulaParser
// independent character evaluation (order not important) // independent character evaluation (order not important)
// establish state-dependent character evaluations // 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)) { if (strlen($value > 0)) {
// unexpected // unexpected
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
@ -265,7 +265,7 @@ class PHPExcel_Calculation_FormulaParser
continue; continue;
} }
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) { if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
// unexpected // unexpected
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
@ -276,14 +276,14 @@ class PHPExcel_Calculation_FormulaParser
continue; continue;
} }
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_OPEN) { if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::BRACKET_OPEN) {
$inRange = true; $inRange = true;
$value .= PHPExcel_Calculation_FormulaParser::BRACKET_OPEN; $value .= PHPExcel_Calculation_FormulaParser::BRACKET_OPEN;
++$index; ++$index;
continue; continue;
} }
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::ERROR_START) { if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::ERROR_START) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
// unexpected // unexpected
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); $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 // 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) { if (strlen($value) > 0) {
// unexpected // unexpected
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN); $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
@ -315,7 +315,7 @@ class PHPExcel_Calculation_FormulaParser
continue; continue;
} }
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::SEMICOLON) { if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::SEMICOLON) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
$value = ""; $value = "";
@ -337,7 +337,7 @@ class PHPExcel_Calculation_FormulaParser
continue; continue;
} }
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_CLOSE) { if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::BRACE_CLOSE) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
$value = ""; $value = "";
@ -358,14 +358,14 @@ class PHPExcel_Calculation_FormulaParser
} }
// trim white-space // trim white-space
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) { if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::WHITESPACE) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
$value = ""; $value = "";
} }
$tokens1[] = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE); $tokens1[] = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE);
++$index; ++$index;
while (($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) && ($index < $formulaLength)) { while (($this->formula[$index] == PHPExcel_Calculation_FormulaParser::WHITESPACE) && ($index < $formulaLength)) {
++$index; ++$index;
} }
continue; continue;
@ -385,29 +385,29 @@ class PHPExcel_Calculation_FormulaParser
} }
// standard infix operators // 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) { if (strlen($value) > 0) {
$tokens1[] =new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] =new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
$value = ""; $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; ++$index;
continue; continue;
} }
// standard postfix operators (only one) // 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) { if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
$value = ""; $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; ++$index;
continue; continue;
} }
// start subexpression or function // 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) { if (strlen($value) > 0) {
$tmp = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START); $tmp = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
$tokens1[] = $tmp; $tokens1[] = $tmp;
@ -423,7 +423,7 @@ class PHPExcel_Calculation_FormulaParser
} }
// function, subexpression, or array parameters, or operand unions // 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) { if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
$value = ""; $value = "";
@ -444,7 +444,7 @@ class PHPExcel_Calculation_FormulaParser
} }
// stop subexpression // stop subexpression
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_CLOSE) { if ($this->formula[$index] == PHPExcel_Calculation_FormulaParser::PAREN_CLOSE) {
if (strlen($value) > 0) { if (strlen($value) > 0) {
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND); $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
$value = ""; $value = "";
@ -460,7 +460,7 @@ class PHPExcel_Calculation_FormulaParser
} }
// token accumulation // token accumulation
$value .= $this->formula{$index}; $value .= $this->formula[$index];
++$index; ++$index;
} }

4
include/PHPExcel/Calculation/Functions.php

@ -559,7 +559,7 @@ class PHPExcel_Calculation_Functions
return (integer) $value; return (integer) $value;
case 'string': case 'string':
// Errors // Errors
if ((strlen($value) > 0) && ($value{0} == '#')) { if ((strlen($value) > 0) && ($value[0] == '#')) {
return $value; return $value;
} }
break; break;
@ -609,7 +609,7 @@ class PHPExcel_Calculation_Functions
return 64; return 64;
} elseif (is_string($value)) { } elseif (is_string($value)) {
// Errors // Errors
if ((strlen($value) > 0) && ($value{0} == '#')) { if ((strlen($value) > 0) && ($value[0] == '#')) {
return 16; return 16;
} }
return 2; return 2;

4
include/PHPExcel/Cell.php

@ -814,10 +814,10 @@ class PHPExcel_Cell
$_indexCache[$pString] = $_columnLookup[$pString]; $_indexCache[$pString] = $_columnLookup[$pString];
return $_indexCache[$pString]; return $_indexCache[$pString];
} elseif (!isset($pString[2])) { } elseif (!isset($pString[2])) {
$_indexCache[$pString] = $_columnLookup[$pString[0] * 26 + $_columnLookup[$pString[1]; $_indexCache[$pString] = $_columnLookup[$pString[0]] * 26 + $_columnLookup[$pString[1]];
return $_indexCache[$pString]; return $_indexCache[$pString];
} elseif (!isset($pString[3])) { } elseif (!isset($pString[3])) {
$_indexCache[$pString] = $_columnLookup[$pString[0] * 676 + $_columnLookup[$pString[1] * 26 + $_columnLookup[$pString[2]; $_indexCache[$pString] = $_columnLookup[$pString[0]] * 676 + $_columnLookup[$pString[1]] * 26 + $_columnLookup[$pString[2]];
return $_indexCache[$pString]; return $_indexCache[$pString];
} }
} }

4
include/PHPExcel/Cell/DefaultValueBinder.php

@ -79,7 +79,7 @@ class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
return PHPExcel_Cell_DataType::TYPE_STRING; return PHPExcel_Cell_DataType::TYPE_STRING;
} elseif ($pValue instanceof PHPExcel_RichText) { } elseif ($pValue instanceof PHPExcel_RichText) {
return PHPExcel_Cell_DataType::TYPE_INLINE; return PHPExcel_Cell_DataType::TYPE_INLINE;
} elseif ($pValue{0} === '=' && strlen($pValue) > 1) { } elseif ($pValue[0] === '=' && strlen($pValue) > 1) {
return PHPExcel_Cell_DataType::TYPE_FORMULA; return PHPExcel_Cell_DataType::TYPE_FORMULA;
} elseif (is_bool($pValue)) { } elseif (is_bool($pValue)) {
return PHPExcel_Cell_DataType::TYPE_BOOL; return PHPExcel_Cell_DataType::TYPE_BOOL;
@ -87,7 +87,7 @@ class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
return PHPExcel_Cell_DataType::TYPE_NUMERIC; return PHPExcel_Cell_DataType::TYPE_NUMERIC;
} elseif (preg_match('/^[\+\-]?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)([Ee][\-\+]?[0-2]?\d{1,3})?$/', $pValue)) { } elseif (preg_match('/^[\+\-]?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)([Ee][\-\+]?[0-2]?\d{1,3})?$/', $pValue)) {
$tValue = ltrim($pValue, '+-'); $tValue = ltrim($pValue, '+-');
if (is_string($pValue) && $tValue{0} === '0' && strlen($tValue) > 1 && $tValue{1} !== '.') { if (is_string($pValue) && $tValue[0] === '0' && strlen($tValue) > 1 && $tValue[1] !== '.') {
return PHPExcel_Cell_DataType::TYPE_STRING; return PHPExcel_Cell_DataType::TYPE_STRING;
} elseif ((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) { } elseif ((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) {
return PHPExcel_Cell_DataType::TYPE_STRING; return PHPExcel_Cell_DataType::TYPE_STRING;

94
include/PHPExcel/Reader/Excel5.php

@ -1988,7 +1988,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
} }
// offset: 10; size: 1; underline type // offset: 10; size: 1; underline type
$underlineType = ord($recordData{10}); $underlineType = ord($recordData[10]);
switch ($underlineType) { switch ($underlineType) {
case 0x00: case 0x00:
break; // no underline break; // no underline
@ -2125,7 +2125,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
// offset: 6; size: 1; Alignment and text break // offset: 6; size: 1; Alignment and text break
// bit 2-0, mask 0x07; horizontal alignment // bit 2-0, mask 0x07; horizontal alignment
$horAlign = (0x07 & ord($recordData{6})) >> 0; $horAlign = (0x07 & ord($recordData[6])) >> 0;
switch ($horAlign) { switch ($horAlign) {
case 0: case 0:
$objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_GENERAL); $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_GENERAL);
@ -2150,7 +2150,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
break; break;
} }
// bit 3, mask 0x08; wrap text // bit 3, mask 0x08; wrap text
$wrapText = (0x08 & ord($recordData{6})) >> 3; $wrapText = (0x08 & ord($recordData[6])) >> 3;
switch ($wrapText) { switch ($wrapText) {
case 0: case 0:
$objStyle->getAlignment()->setWrapText(false); $objStyle->getAlignment()->setWrapText(false);
@ -2160,7 +2160,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
break; break;
} }
// bit 6-4, mask 0x70; vertical alignment // bit 6-4, mask 0x70; vertical alignment
$vertAlign = (0x70 & ord($recordData{6})) >> 4; $vertAlign = (0x70 & ord($recordData[6])) >> 4;
switch ($vertAlign) { switch ($vertAlign) {
case 0: case 0:
$objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP); $objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
@ -2178,7 +2178,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
if ($this->version == self::XLS_BIFF8) { if ($this->version == self::XLS_BIFF8) {
// offset: 7; size: 1; XF_ROTATION: Text rotation angle // offset: 7; size: 1; XF_ROTATION: Text rotation angle
$angle = ord($recordData{7}); $angle = ord($recordData[7]);
$rotation = 0; $rotation = 0;
if ($angle <= 90) { if ($angle <= 90) {
$rotation = $angle; $rotation = $angle;
@ -2191,11 +2191,11 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
// offset: 8; size: 1; Indentation, shrink to cell size, and text direction // offset: 8; size: 1; Indentation, shrink to cell size, and text direction
// bit: 3-0; mask: 0x0F; indent level // bit: 3-0; mask: 0x0F; indent level
$indent = (0x0F & ord($recordData{8})) >> 0; $indent = (0x0F & ord($recordData[8])) >> 0;
$objStyle->getAlignment()->setIndent($indent); $objStyle->getAlignment()->setIndent($indent);
// bit: 4; mask: 0x10; 1 = shrink content to fit into cell // bit: 4; mask: 0x10; 1 = shrink content to fit into cell
$shrinkToFit = (0x10 & ord($recordData{8})) >> 4; $shrinkToFit = (0x10 & ord($recordData[8])) >> 4;
switch ($shrinkToFit) { switch ($shrinkToFit) {
case 0: case 0:
$objStyle->getAlignment()->setShrinkToFit(false); $objStyle->getAlignment()->setShrinkToFit(false);
@ -2275,7 +2275,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
// BIFF5 // BIFF5
// offset: 7; size: 1; Text orientation and flags // offset: 7; size: 1; Text orientation and flags
$orientationAndFlags = ord($recordData{7}); $orientationAndFlags = ord($recordData[7]);
// bit: 1-0; mask: 0x03; XF_ORIENTATION: Text orientation // bit: 1-0; mask: 0x03; XF_ORIENTATION: Text orientation
$xfOrientation = (0x03 & $orientationAndFlags) >> 0; $xfOrientation = (0x03 & $orientationAndFlags) >> 0;
@ -2399,7 +2399,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
if ($xclfType == 2) { if ($xclfType == 2) {
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
// modify the relevant style property // modify the relevant style property
if (isset($this->mapCellXfIndex[$ixfe])) { if (isset($this->mapCellXfIndex[$ixfe])) {
@ -2414,7 +2414,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
if ($xclfType == 2) { if ($xclfType == 2) {
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
// modify the relevant style property // modify the relevant style property
if (isset($this->mapCellXfIndex[$ixfe])) { if (isset($this->mapCellXfIndex[$ixfe])) {
@ -2429,7 +2429,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
if ($xclfType == 2) { if ($xclfType == 2) {
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
// modify the relevant style property // modify the relevant style property
if (isset($this->mapCellXfIndex[$ixfe])) { if (isset($this->mapCellXfIndex[$ixfe])) {
@ -2444,7 +2444,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
if ($xclfType == 2) { if ($xclfType == 2) {
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
// modify the relevant style property // modify the relevant style property
if (isset($this->mapCellXfIndex[$ixfe])) { if (isset($this->mapCellXfIndex[$ixfe])) {
@ -2459,7 +2459,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
if ($xclfType == 2) { if ($xclfType == 2) {
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
// modify the relevant style property // modify the relevant style property
if (isset($this->mapCellXfIndex[$ixfe])) { if (isset($this->mapCellXfIndex[$ixfe])) {
@ -2474,7 +2474,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
if ($xclfType == 2) { if ($xclfType == 2) {
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
// modify the relevant style property // modify the relevant style property
if (isset($this->mapCellXfIndex[$ixfe])) { if (isset($this->mapCellXfIndex[$ixfe])) {
@ -2489,7 +2489,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
if ($xclfType == 2) { if ($xclfType == 2) {
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
// modify the relevant style property // modify the relevant style property
if (isset($this->mapCellXfIndex[$ixfe])) { if (isset($this->mapCellXfIndex[$ixfe])) {
@ -2504,7 +2504,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) $xclrValue = substr($extData, 4, 4); // color value (value based on color type)
if ($xclfType == 2) { if ($xclfType == 2) {
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); $rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2]));
// modify the relevant style property // modify the relevant style property
if (isset($this->mapCellXfIndex[$ixfe])) { if (isset($this->mapCellXfIndex[$ixfe])) {
@ -2546,7 +2546,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
if ($isBuiltIn) { if ($isBuiltIn) {
// offset: 2; size: 1; identifier for built-in style // offset: 2; size: 1; identifier for built-in style
$builtInId = ord($recordData{2}); $builtInId = ord($recordData[2]);
switch ($builtInId) { switch ($builtInId) {
case 0x00: case 0x00:
@ -2611,7 +2611,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$this->pos += 4 + $length; $this->pos += 4 + $length;
// offset: 4; size: 1; sheet state // offset: 4; size: 1; sheet state
switch (ord($recordData{4})) { switch (ord($recordData[4])) {
case 0x00: case 0x00:
$sheetState = PHPExcel_Worksheet::SHEETSTATE_VISIBLE; $sheetState = PHPExcel_Worksheet::SHEETSTATE_VISIBLE;
break; break;
@ -2627,7 +2627,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
} }
// offset: 5; size: 1; sheet type // offset: 5; size: 1; sheet type
$sheetType = ord($recordData{5}); $sheetType = ord($recordData[5]);
// offset: 6; size: var; sheet name // offset: 6; size: var; sheet name
if ($this->version == self::XLS_BIFF8) { if ($this->version == self::XLS_BIFF8) {
@ -2805,7 +2805,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
// offset: 2; size: 1; keyboard shortcut // offset: 2; size: 1; keyboard shortcut
// offset: 3; size: 1; length of the name (character count) // offset: 3; size: 1; length of the name (character count)
$nlen = ord($recordData{3}); $nlen = ord($recordData[3]);
// offset: 4; size: 2; size of the formula data (it can happen that this is zero) // offset: 4; size: 2; size of the formula data (it can happen that this is zero)
// note: there can also be additional data, this is not included in $flen // note: there can also be additional data, this is not included in $flen
@ -2888,7 +2888,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$pos += 2; $pos += 2;
// option flags // option flags
$optionFlags = ord($recordData{$pos}); $optionFlags = ord($recordData[$pos]);
++$pos; ++$pos;
// bit: 0; mask: 0x01; 0 = compressed; 1 = uncompressed // bit: 0; mask: 0x01; 0 = compressed; 1 = uncompressed
@ -2955,7 +2955,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
// repeated option flags // repeated option flags
// OpenOffice.org documentation 5.21 // OpenOffice.org documentation 5.21
$option = ord($recordData{$pos}); $option = ord($recordData[$pos]);
++$pos; ++$pos;
if ($isCompressed && ($option == 0)) { if ($isCompressed && ($option == 0)) {
@ -2977,7 +2977,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
// this fragment compressed // this fragment compressed
$len = min($charsLeft, $limitpos - $pos); $len = min($charsLeft, $limitpos - $pos);
for ($j = 0; $j < $len; ++$j) { for ($j = 0; $j < $len; ++$j) {
$retstr .= $recordData{$pos + $j} . chr(0); $retstr .= $recordData[$pos + $j] . chr(0);
} }
$charsLeft -= $len; $charsLeft -= $len;
$isCompressed = false; $isCompressed = false;
@ -3883,7 +3883,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
// We can apparently not rely on $isPartOfSharedFormula. Even when $isPartOfSharedFormula = true // We can apparently not rely on $isPartOfSharedFormula. Even when $isPartOfSharedFormula = true
// the formula data may be ordinary formula data, therefore we need to check // the formula data may be ordinary formula data, therefore we need to check
// explicitly for the tExp token (0x01) // explicitly for the tExp token (0x01)
$isPartOfSharedFormula = $isPartOfSharedFormula && ord($formulaStructure{2}) == 0x01; $isPartOfSharedFormula = $isPartOfSharedFormula && ord($formulaStructure[2]) == 0x01;
if ($isPartOfSharedFormula) { if ($isPartOfSharedFormula) {
// part of shared formula which means there will be a formula with a tExp token and nothing else // part of shared formula which means there will be a formula with a tExp token and nothing else
@ -3906,7 +3906,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$xfIndex = self::getInt2d($recordData, 4); $xfIndex = self::getInt2d($recordData, 4);
// offset: 6; size: 8; result of the formula // offset: 6; size: 8; result of the formula
if ((ord($recordData{6}) == 0) && (ord($recordData{12}) == 255) && (ord($recordData{13}) == 255)) { if ((ord($recordData[6]) == 0) && (ord($recordData[12]) == 255) && (ord($recordData[13]) == 255)) {
// String formula. Result follows in appended STRING record // String formula. Result follows in appended STRING record
$dataType = PHPExcel_Cell_DataType::TYPE_STRING; $dataType = PHPExcel_Cell_DataType::TYPE_STRING;
@ -3918,21 +3918,21 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
// read STRING record // read STRING record
$value = $this->readString(); $value = $this->readString();
} elseif ((ord($recordData{6}) == 1) } elseif ((ord($recordData[6]) == 1)
&& (ord($recordData{12}) == 255) && (ord($recordData[12]) == 255)
&& (ord($recordData{13}) == 255)) { && (ord($recordData[13]) == 255)) {
// Boolean formula. Result is in +2; 0=false, 1=true // Boolean formula. Result is in +2; 0=false, 1=true
$dataType = PHPExcel_Cell_DataType::TYPE_BOOL; $dataType = PHPExcel_Cell_DataType::TYPE_BOOL;
$value = (bool) ord($recordData{8}); $value = (bool) ord($recordData[8]);
} elseif ((ord($recordData{6}) == 2) } elseif ((ord($recordData[6]) == 2)
&& (ord($recordData{12}) == 255) && (ord($recordData[12]) == 255)
&& (ord($recordData{13}) == 255)) { && (ord($recordData[13]) == 255)) {
// Error formula. Error code is in +2 // Error formula. Error code is in +2
$dataType = PHPExcel_Cell_DataType::TYPE_ERROR; $dataType = PHPExcel_Cell_DataType::TYPE_ERROR;
$value = PHPExcel_Reader_Excel5_ErrorCode::lookup(ord($recordData{8})); $value = PHPExcel_Reader_Excel5_ErrorCode::lookup(ord($recordData[8]));
} elseif ((ord($recordData{6}) == 3) } elseif ((ord($recordData[6]) == 3)
&& (ord($recordData{12}) == 255) && (ord($recordData[12]) == 255)
&& (ord($recordData{13}) == 255)) { && (ord($recordData[13]) == 255)) {
// Formula result is a null string // Formula result is a null string
$dataType = PHPExcel_Cell_DataType::TYPE_NULL; $dataType = PHPExcel_Cell_DataType::TYPE_NULL;
$value = ''; $value = '';
@ -3996,7 +3996,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
// offset: 6, size: 1; not used // offset: 6, size: 1; not used
// offset: 7, size: 1; number of existing FORMULA records for this shared formula // offset: 7, size: 1; number of existing FORMULA records for this shared formula
$no = ord($recordData{7}); $no = ord($recordData[7]);
// offset: 8, size: var; Binary token array of the shared formula // offset: 8, size: var; Binary token array of the shared formula
$formula = substr($recordData, 8); $formula = substr($recordData, 8);
@ -4062,10 +4062,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$xfIndex = self::getInt2d($recordData, 4); $xfIndex = self::getInt2d($recordData, 4);
// offset: 6; size: 1; the boolean value or error value // offset: 6; size: 1; the boolean value or error value
$boolErr = ord($recordData{6}); $boolErr = ord($recordData[6]);
// offset: 7; size: 1; 0=boolean; 1=error // offset: 7; size: 1; 0=boolean; 1=error
$isError = ord($recordData{7}); $isError = ord($recordData[7]);
$cell = $this->phpSheet->getCell($columnString . ($row + 1)); $cell = $this->phpSheet->getCell($columnString . ($row + 1));
switch ($isError) { switch ($isError) {
@ -4447,7 +4447,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
if (!$this->readDataOnly) { if (!$this->readDataOnly) {
// offset: 0; size: 1; pane identifier // offset: 0; size: 1; pane identifier
$paneId = ord($recordData{0}); $paneId = ord($recordData[0]);
// offset: 1; size: 2; index to row of the active cell // offset: 1; size: 2; index to row of the active cell
$r = self::getInt2d($recordData, 1); $r = self::getInt2d($recordData, 1);
@ -4598,9 +4598,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$hyperlinkType = 'UNC'; $hyperlinkType = 'UNC';
} elseif (!$isFileLinkOrUrl) { } elseif (!$isFileLinkOrUrl) {
$hyperlinkType = 'workbook'; $hyperlinkType = 'workbook';
} elseif (ord($recordData{$offset}) == 0x03) { } elseif (ord($recordData[$offset]) == 0x03) {
$hyperlinkType = 'local'; $hyperlinkType = 'local';
} elseif (ord($recordData{$offset}) == 0xE0) { } elseif (ord($recordData[$offset]) == 0xE0) {
$hyperlinkType = 'URL'; $hyperlinkType = 'URL';
} }
@ -6886,10 +6886,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
$lr = self::getInt2d($subData, 2) + 1; $lr = self::getInt2d($subData, 2) + 1;
// offset: 4; size: 1; index to first column // offset: 4; size: 1; index to first column
$fc = ord($subData{4}); $fc = ord($subData[4]);
// offset: 5; size: 1; index to last column // offset: 5; size: 1; index to last column
$lc = ord($subData{5}); $lc = ord($subData[5]);
// check values // check values
if ($fr > $lr || $fc > $lc) { if ($fr > $lr || $fc > $lc) {
@ -7294,13 +7294,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
private static function readRGB($rgb) private static function readRGB($rgb)
{ {
// offset: 0; size 1; Red component // offset: 0; size 1; Red component
$r = ord($rgb{0}); $r = ord($rgb[0]);
// offset: 1; size: 1; Green component // offset: 1; size: 1; Green component
$g = ord($rgb{1}); $g = ord($rgb[1]);
// offset: 2; size: 1; Blue component // offset: 2; size: 1; Blue component
$b = ord($rgb{2}); $b = ord($rgb[2]);
// HEX notation, e.g. 'FF00FC' // HEX notation, e.g. 'FF00FC'
$rgb = sprintf('%02X%02X%02X', $r, $g, $b); $rgb = sprintf('%02X%02X%02X', $r, $g, $b);

4
include/PHPExcel/Reader/Excel5/Escher.php

@ -331,7 +331,7 @@ class PHPExcel_Reader_Excel5_Escher
} }
// offset: var; size: 1; tag // offset: var; size: 1; tag
$tag = ord($recordData{$pos}); $tag = ord($recordData[$pos]);
$pos += 1; $pos += 1;
// offset: var; size: var; the raw image data // offset: var; size: var; the raw image data
@ -372,7 +372,7 @@ class PHPExcel_Reader_Excel5_Escher
} }
// offset: var; size: 1; tag // offset: var; size: 1; tag
$tag = ord($recordData{$pos}); $tag = ord($recordData[$pos]);
$pos += 1; $pos += 1;
// offset: var; size: var; the raw image data // offset: var; size: var; the raw image data

16
include/PHPExcel/Reader/SYLK.php

@ -249,7 +249,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
if ($dataType == 'P') { if ($dataType == 'P') {
$formatArray = array(); $formatArray = array();
foreach ($rowData as $rowDatum) { foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) { switch ($rowDatum[0]) {
case 'P': case 'P':
$formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1)); $formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1));
break; break;
@ -263,7 +263,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
case 'S': case 'S':
$styleSettings = substr($rowDatum, 1); $styleSettings = substr($rowDatum, 1);
for ($i=0; $i<strlen($styleSettings); ++$i) { for ($i=0; $i<strlen($styleSettings); ++$i) {
switch ($styleSettings{$i}) { switch ($styleSettings[$i]) {
case 'I': case 'I':
$formatArray['font']['italic'] = true; $formatArray['font']['italic'] = true;
break; break;
@ -293,7 +293,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
$hasCalculatedValue = false; $hasCalculatedValue = false;
$cellData = $cellDataFormula = ''; $cellData = $cellDataFormula = '';
foreach ($rowData as $rowDatum) { foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) { switch ($rowDatum[0]) {
case 'C': case 'C':
case 'X': case 'X':
$column = substr($rowDatum, 1); $column = substr($rowDatum, 1);
@ -327,7 +327,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
$rowReference = $row; $rowReference = $row;
} }
// Bracketed R references are relative to the current row // Bracketed R references are relative to the current row
if ($rowReference{0} == '[') { if ($rowReference[0] == '[') {
$rowReference = $row + trim($rowReference, '[]'); $rowReference = $row + trim($rowReference, '[]');
} }
$columnReference = $cellReference[4][0]; $columnReference = $cellReference[4][0];
@ -336,7 +336,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
$columnReference = $column; $columnReference = $column;
} }
// Bracketed C references are relative to the current column // Bracketed C references are relative to the current column
if ($columnReference{0} == '[') { if ($columnReference[0] == '[') {
$columnReference = $column + trim($columnReference, '[]'); $columnReference = $column + trim($columnReference, '[]');
} }
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference; $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
@ -366,7 +366,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
$formatStyle = $columnWidth = $styleSettings = ''; $formatStyle = $columnWidth = $styleSettings = '';
$styleData = array(); $styleData = array();
foreach ($rowData as $rowDatum) { foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) { switch ($rowDatum[0]) {
case 'C': case 'C':
case 'X': case 'X':
$column = substr($rowDatum, 1); $column = substr($rowDatum, 1);
@ -384,7 +384,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
case 'S': case 'S':
$styleSettings = substr($rowDatum, 1); $styleSettings = substr($rowDatum, 1);
for ($i=0; $i<strlen($styleSettings); ++$i) { for ($i=0; $i<strlen($styleSettings); ++$i) {
switch ($styleSettings{$i}) { switch ($styleSettings[$i]) {
case 'I': case 'I':
$styleData['font']['italic'] = true; $styleData['font']['italic'] = true;
break; break;
@ -433,7 +433,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
} }
} else { } else {
foreach ($rowData as $rowDatum) { foreach ($rowData as $rowDatum) {
switch ($rowDatum{0}) { switch ($rowDatum[0]) {
case 'C': case 'C':
case 'X': case 'X':
$column = substr($rowDatum, 1); $column = substr($rowDatum, 1);

4
include/PHPExcel/Shared/OLE.php

@ -285,7 +285,7 @@ class PHPExcel_Shared_OLE
$pps = new PHPExcel_Shared_OLE_PPS_File($name); $pps = new PHPExcel_Shared_OLE_PPS_File($name);
break; break;
default: default:
continue; continue 2;
} }
fseek($fh, 1, SEEK_CUR); fseek($fh, 1, SEEK_CUR);
$pps->Type = $type; $pps->Type = $type;
@ -443,7 +443,7 @@ class PHPExcel_Shared_OLE
{ {
$rawname = ''; $rawname = '';
for ($i = 0; $i < strlen($ascii); ++$i) { for ($i = 0; $i < strlen($ascii); ++$i) {
$rawname .= $ascii{$i} . "\x00"; $rawname .= $ascii[$i] . "\x00";
} }
return $rawname; return $rawname;
} }

12
include/PHPExcel/Shared/String.php

@ -523,8 +523,8 @@ class PHPExcel_Shared_String
if (strlen($str) < 2) { if (strlen($str) < 2) {
return $str; return $str;
} }
$c0 = ord($str{0}); $c0 = ord($str[0]);
$c1 = ord($str{1}); $c1 = ord($str[1]);
if ($c0 == 0xfe && $c1 == 0xff) { if ($c0 == 0xfe && $c1 == 0xff) {
$str = substr($str, 2); $str = substr($str, 2);
} elseif ($c0 == 0xff && $c1 == 0xfe) { } elseif ($c0 == 0xff && $c1 == 0xfe) {
@ -535,11 +535,11 @@ class PHPExcel_Shared_String
$newstr = ''; $newstr = '';
for ($i=0; $i<$len; $i+=2) { for ($i=0; $i<$len; $i+=2) {
if ($bom_be) { if ($bom_be) {
$val = ord($str{$i}) << 4; $val = ord($str[$i]) << 4;
$val += ord($str{$i+1}); $val += ord($str[$i+1]);
} else { } else {
$val = ord($str{$i+1}) << 4; $val = ord($str[$i+1]) << 4;
$val += ord($str{$i}); $val += ord($str[$i]);
} }
$newstr .= ($val == 0x228) ? "\n" : chr($val); $newstr .= ($val == 0x228) ? "\n" : chr($val);
} }

2
include/PHPExcel/Shared/ZipStreamWrapper.php

@ -76,7 +76,7 @@ class PHPExcel_Shared_ZipStreamWrapper
public function stream_open($path, $mode, $options, &$opened_path) public function stream_open($path, $mode, $options, &$opened_path)
{ {
// Check for mode // Check for mode
if ($mode{0} != 'r') { if ($mode[0] != 'r') {
throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.'); throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.');
} }

14
include/PHPExcel/Writer/Excel5/Parser.php

@ -1020,7 +1020,7 @@ class PHPExcel_Writer_Excel5_Parser
$col = 0; $col = 0;
$col_ref_length = strlen($col_ref); $col_ref_length = strlen($col_ref);
for ($i = 0; $i < $col_ref_length; ++$i) { 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; --$expn;
} }
@ -1042,21 +1042,21 @@ class PHPExcel_Writer_Excel5_Parser
$formula_length = strlen($this->formula); $formula_length = strlen($this->formula);
// eat up white spaces // eat up white spaces
if ($i < $formula_length) { if ($i < $formula_length) {
while ($this->formula{$i} == " ") { while ($this->formula[$i] == " ") {
++$i; ++$i;
} }
if ($i < ($formula_length - 1)) { if ($i < ($formula_length - 1)) {
$this->lookAhead = $this->formula{$i+1}; $this->lookAhead = $this->formula[$i+1];
} }
$token = ''; $token = '';
} }
while ($i < $formula_length) { while ($i < $formula_length) {
$token .= $this->formula{$i}; $token .= $this->formula[$i];
if ($i < ($formula_length - 1)) { if ($i < ($formula_length - 1)) {
$this->lookAhead = $this->formula{$i+1}; $this->lookAhead = $this->formula[$i+1];
} else { } else {
$this->lookAhead = ''; $this->lookAhead = '';
} }
@ -1071,7 +1071,7 @@ class PHPExcel_Writer_Excel5_Parser
} }
if ($i < ($formula_length - 2)) { if ($i < ($formula_length - 2)) {
$this->lookAhead = $this->formula{$i+2}; $this->lookAhead = $this->formula[$i+2];
} else { // if we run out of characters lookAhead becomes empty } else { // if we run out of characters lookAhead becomes empty
$this->lookAhead = ''; $this->lookAhead = '';
} }
@ -1172,7 +1172,7 @@ class PHPExcel_Writer_Excel5_Parser
{ {
$this->currentCharacter = 0; $this->currentCharacter = 0;
$this->formula = $formula; $this->formula = $formula;
$this->lookAhead = isset($formula{1}) ? $formula{1} : ''; $this->lookAhead = isset($formula[1]) ? $formula[1] : '';
$this->advance(); $this->advance();
$this->parseTree = $this->condition(); $this->parseTree = $this->condition();
return true; return true;

2
include/PHPExcel/Writer/Excel5/Workbook.php

@ -664,7 +664,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$formulaData = $this->parser->toReversePolish(); $formulaData = $this->parser->toReversePolish();
// make sure tRef3d is of type tRef3dR (0x3A) // make sure tRef3d is of type tRef3dR (0x3A)
if (isset($formulaData{0}) and ($formulaData{0} == "\x7A" or $formulaData{0} == "\x5A")) { if (isset($formulaData[0]) and ($formulaData[0] == "\x7A" or $formulaData[0] == "\x5A")) {
$formulaData = "\x3A" . substr($formulaData, 1); $formulaData = "\x3A" . substr($formulaData, 1);
} }

2
include/PHPExcel/Writer/Excel5/Worksheet.php

@ -876,7 +876,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$unknown = 0x0000; // Must be zero $unknown = 0x0000; // Must be zero
// Strip the '=' or '@' sign at the beginning of the formula string // Strip the '=' or '@' sign at the beginning of the formula string
if ($formula{0} == '=') { if ($formula[0] == '=') {
$formula = substr($formula, 1); $formula = substr($formula, 1);
} else { } else {
// Error handling // Error handling

58
include/phpagi/phpagi.php

@ -918,7 +918,7 @@ class AGI
$proceed = false; $proceed = false;
if($escape_digits != '' && $buffer != '') if($escape_digits != '' && $buffer != '')
{ {
if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) if(!strpos(chr(255) . $escape_digits, $buffer[strlen($buffer)-1]))
$proceed = true; $proceed = true;
} }
if($buffer == '' || $proceed) if($buffer == '' || $proceed)
@ -928,7 +928,7 @@ class AGI
$buffer .= chr($res['result']); $buffer .= chr($res['result']);
return $res; return $res;
} }
return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1})); return array('code'=>AGIRES_OK, 'result'=>ord($buffer[strlen($buffer)-1]));
} }
/** /**
@ -947,7 +947,7 @@ class AGI
$proceed = false; $proceed = false;
if($escape_digits != '' && $buffer != '') if($escape_digits != '' && $buffer != '')
{ {
if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) if(!strpos(chr(255) . $escape_digits, $buffer[strlen($buffer)-1]))
$proceed = true; $proceed = true;
} }
if($buffer == '' || $proceed) if($buffer == '' || $proceed)
@ -957,7 +957,7 @@ class AGI
$buffer .= chr($res['result']); $buffer .= chr($res['result']);
return $res; return $res;
} }
return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1})); return array('code'=>AGIRES_OK, 'result'=>ord($buffer[strlen($buffer)-1]));
} }
/** /**
@ -976,7 +976,7 @@ class AGI
$proceed = false; $proceed = false;
if($escape_digits != '' && $buffer != '') if($escape_digits != '' && $buffer != '')
{ {
if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) if(!strpos(chr(255) . $escape_digits, $buffer[strlen($buffer)-1]))
$proceed = true; $proceed = true;
} }
if($buffer == '' || $proceed) if($buffer == '' || $proceed)
@ -986,7 +986,7 @@ class AGI
$buffer .= chr($res['result']); $buffer .= chr($res['result']);
return $res; return $res;
} }
return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1})); return array('code'=>AGIRES_OK, 'result'=>ord($buffer[strlen($buffer)-1]));
} }
/** /**
@ -1005,7 +1005,7 @@ class AGI
$proceed = false; $proceed = false;
if($escape_digits != '' && $buffer != '') if($escape_digits != '' && $buffer != '')
{ {
if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) if(!strpos(chr(255) . $escape_digits, $buffer[strlen($buffer)-1]))
$proceed = true; $proceed = true;
} }
if($buffer == '' || $proceed) if($buffer == '' || $proceed)
@ -1015,7 +1015,7 @@ class AGI
$buffer .= chr($res['result']); $buffer .= chr($res['result']);
return $res; return $res;
} }
return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1})); return array('code'=>AGIRES_OK, 'result'=>ord($buffer[strlen($buffer)-1]));
} }
/** /**
@ -1037,7 +1037,7 @@ class AGI
$proceed = false; $proceed = false;
if($escape_digits != '' && $buffer != '') if($escape_digits != '' && $buffer != '')
{ {
if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) if(!strpos(chr(255) . $escape_digits, $buffer[strlen($buffer)-1]))
$proceed = true; $proceed = true;
} }
if($buffer == '' || $proceed) if($buffer == '' || $proceed)
@ -1047,7 +1047,7 @@ class AGI
$buffer .= chr($res['result']); $buffer .= chr($res['result']);
return $res; return $res;
} }
return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1}), 'endpos'=>0); return array('code'=>AGIRES_OK, 'result'=>ord($buffer[strlen($buffer)-1]), 'endpos'=>0);
} }
/** /**
@ -1066,7 +1066,7 @@ class AGI
$proceed = false; $proceed = false;
if($escape_digits != '' && $buffer != '') if($escape_digits != '' && $buffer != '')
{ {
if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) if(!strpos(chr(255) . $escape_digits, $buffer[strlen($buffer)-1]))
$proceed = true; $proceed = true;
} }
if($buffer == '' || $proceed) if($buffer == '' || $proceed)
@ -1076,7 +1076,7 @@ class AGI
$buffer .= chr($res['result']); $buffer .= chr($res['result']);
return $res; return $res;
} }
return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1}), 'endpos'=>0); return array('code'=>AGIRES_OK, 'result'=>ord($buffer[strlen($buffer)-1]), 'endpos'=>0);
} }
/** /**
@ -1095,7 +1095,7 @@ class AGI
$proceed = false; $proceed = false;
if($escape_digits != '' && $buffer != '') if($escape_digits != '' && $buffer != '')
{ {
if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) if(!strpos(chr(255) . $escape_digits, $buffer[strlen($buffer)-1]))
$proceed = true; $proceed = true;
} }
if($buffer == '' || $proceed) if($buffer == '' || $proceed)
@ -1105,7 +1105,7 @@ class AGI
$buffer .= chr($res['result']); $buffer .= chr($res['result']);
return $res; return $res;
} }
return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1}), 'endpos'=>0); return array('code'=>AGIRES_OK, 'result'=>ord($buffer[strlen($buffer)-1]), 'endpos'=>0);
} }
/** /**
@ -1123,7 +1123,7 @@ class AGI
$proceed = false; $proceed = false;
if($escape_digits != '' && $buffer != '') if($escape_digits != '' && $buffer != '')
{ {
if(!strpos(chr(255) . $escape_digits, $buffer{strlen($buffer)-1})) if(!strpos(chr(255) . $escape_digits, $buffer[strlen($buffer)-1]))
$proceed = true; $proceed = true;
} }
if($buffer == '' || $proceed) if($buffer == '' || $proceed)
@ -1133,7 +1133,7 @@ class AGI
$buffer .= chr($res['result']); $buffer .= chr($res['result']);
return $res; return $res;
} }
return array('code'=>AGIRES_OK, 'result'=>ord($buffer{strlen($buffer)-1})); return array('code'=>AGIRES_OK, 'result'=>ord($buffer[strlen($buffer)-1]));
} }
/** /**
@ -1221,7 +1221,7 @@ class AGI
{ {
foreach($choices as $prompt) foreach($choices as $prompt)
{ {
if($prompt{0} == '*') if($prompt[0] == '*')
$ret = $this->text2wav(substr($prompt, 1), $keys); $ret = $this->text2wav(substr($prompt, 1), $keys);
else else
$ret = $this->stream_file($prompt, $keys); $ret = $this->stream_file($prompt, $keys);
@ -1284,9 +1284,9 @@ class AGI
$ret = array('name'=>'', 'protocol'=>'', 'username'=>'', 'host'=>'', 'port'=>''); $ret = array('name'=>'', 'protocol'=>'', 'username'=>'', 'host'=>'', 'port'=>'');
$callerid = trim($callerid); $callerid = trim($callerid);
if($callerid{0} == '"' || $callerid{0} == "'") if($callerid[0] == '"' || $callerid[0] == "'")
{ {
$d = $callerid{0}; $d = $callerid[0];
$callerid = explode($d, substr($callerid, 1)); $callerid = explode($d, substr($callerid, 1));
$ret['name'] = array_shift($callerid); $ret['name'] = array_shift($callerid);
$callerid = join($d, $callerid); $callerid = join($d, $callerid);
@ -1462,7 +1462,7 @@ class AGI
{ {
if($command) if($command)
{ {
switch($code{0}) switch($code[0])
{ {
case '2': $text = substr($text, 0, strlen($text) - 1); break; // backspace case '2': $text = substr($text, 0, strlen($text) - 1); break; // backspace
case '5': $mode = 'LOWERCASE'; break; case '5': $mode = 'LOWERCASE'; break;
@ -1503,7 +1503,7 @@ class AGI
$ret=""; $ret="";
for($i = 0; $i < strlen($text); $i++) for($i = 0; $i < strlen($text); $i++)
{ {
switch($text{$i}) switch($text[$i])
{ {
case ' ': $ret .= 'SPACE '; case ' ': $ret .= 'SPACE ';
case ',': $ret .= 'COMMA '; break; case ',': $ret .= 'COMMA '; break;
@ -1538,7 +1538,7 @@ class AGI
case '|': $ret .= 'BAR '; break; case '|': $ret .= 'BAR '; break;
case '_': $ret .= 'UNDERSCORE '; break; case '_': $ret .= 'UNDERSCORE '; break;
case '~': $ret .= 'TILDE '; break; case '~': $ret .= 'TILDE '; break;
default: $ret .= $text{$i} . ' '; break; default: $ret .= $text[$i] . ' '; break;
} }
} }
return $this->text2wav($ret, $escape_digits, $frequency); return $this->text2wav($ret, $escape_digits, $frequency);
@ -1597,7 +1597,7 @@ class AGI
$ret['code'] = substr($str, 0, 3); $ret['code'] = substr($str, 0, 3);
$str = trim(substr($str, 3)); $str = trim(substr($str, 3));
if($str{0} == '-') // we have a multiline response! if($str[0] == '-') // we have a multiline response!
{ {
$count = 0; $count = 0;
$str = substr($str, 1) . "\n"; $str = substr($str, 1) . "\n";
@ -1631,11 +1631,11 @@ class AGI
if($in_token) // we previously hit a token starting with ')' but not ending in ')' if($in_token) // we previously hit a token starting with ')' but not ending in ')'
{ {
$ret['data'] .= ' ' . trim($token, '() '); $ret['data'] .= ' ' . trim($token, '() ');
if($token{strlen($token)-1} == ')') $in_token = false; if($token[strlen($token)-1] == ')') $in_token = false;
} }
elseif($token{0} == '(') elseif($token[0] == '(')
{ {
if($token{strlen($token)-1} != ')') $in_token = true; if($token[strlen($token)-1] != ')') $in_token = true;
$ret['data'] .= ' ' . trim($token, '() '); $ret['data'] .= ' ' . trim($token, '() ');
} }
elseif(strpos($token, '=')) elseif(strpos($token, '='))
@ -1802,15 +1802,15 @@ class AGI
$ret = ''; $ret = '';
for($i = 0; $i < strlen($message); $i++) for($i = 0; $i < strlen($message); $i++)
{ {
$c = ord($message{$i}); $c = ord($message[$i]);
if($c == 10 || $c == 13 || $c == 9) if($c == 10 || $c == 13 || $c == 9)
$ret .= $message{$i}; $ret .= $message[$i];
elseif($c < 16) elseif($c < 16)
$ret .= '\x0' . dechex($c); $ret .= '\x0' . dechex($c);
elseif($c < 32 || $c > 127) elseif($c < 32 || $c > 127)
$ret .= '\x' . dechex($c); $ret .= '\x' . dechex($c);
else else
$ret .= $message{$i}; $ret .= $message[$i];
} }
$message = $ret; $message = $ret;

2
include/securimage/WavFile.php

@ -1552,7 +1552,7 @@ class WavFile
} else { } else {
// replace // replace
for ($i = 0; $i < $sampleBytes; ++$i) { for ($i = 0; $i < $sampleBytes; ++$i) {
$this->_samples{$offset + $i} = $sampleBinary{$i}; $this->_samples[$offset + $i] = $sampleBinary[$i];
} }
} }

2
include/securimage/securimage.php

@ -1917,7 +1917,7 @@ class Securimage
$length = strlen($code['display']); $length = strlen($code['display']);
for($i = 0; $i < $length; ++$i) { for($i = 0; $i < $length; ++$i) {
$letter = $code['display']{$i}; $letter = $code['display'][$i];
$letters[] = $letter; $letters[] = $letter;
} }
} }

2
monitorAlgar/relatorioMonitoraAlgar.php

@ -86,7 +86,7 @@ if ($rel_clientes = pg_fetch_all($resQueryClientes)) {
<table> <table>
<tr><th>Empresa</th><th>Audios desatualizados ontem</th></tr> <tr><th>Empresa</th><th>Audios desatualizados ontem</th></tr>
<?php foreach ($rel_audios as $audio) { <?php foreach ($rel_audios as $audio) {
echo "<tr><td>{$audio{'emp_cnpj'}}</td><td>{$audio{'qt_audios'}}</td></tr>"; echo "<tr><td>{$audio['emp_cnpj']}</td><td>{$audio['qt_audios']}</td></tr>";
} }
?> ?>
</table> </table>

Loading…
Cancel
Save