diff --git a/PhpOffice/PhpSpreadsheet/Calculation/Calculation.php b/PhpOffice/PhpSpreadsheet/Calculation/Calculation.php index e8e899f..b16caa1 100644 --- a/PhpOffice/PhpSpreadsheet/Calculation/Calculation.php +++ b/PhpOffice/PhpSpreadsheet/Calculation/Calculation.php @@ -3858,8 +3858,10 @@ class Calculation } } + $tIndex = \is_float($token) ? (int) $token : $token; + // if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack - if (isset(self::$binaryOperators[$token])) { + if (isset(self::$binaryOperators[$tIndex])) { // We must have two operands, error if we don't if (($operand2Data = $stack->pop()) === null) { return $this->raiseFormulaError('Internal error - Operand value missing from stack'); diff --git a/PhpOffice/PhpSpreadsheet/Shared/OLE.php b/PhpOffice/PhpSpreadsheet/Shared/OLE.php index efa7522..7f6a1fb 100644 --- a/PhpOffice/PhpSpreadsheet/Shared/OLE.php +++ b/PhpOffice/PhpSpreadsheet/Shared/OLE.php @@ -521,12 +521,12 @@ class OLE $res = ''; for ($i = 0; $i < 4; ++$i) { - $hex = $low_part % 0x100; + $hex = (int) (((int) $low_part) % 0x100); $res .= pack('c', $hex); $low_part /= 0x100; } for ($i = 0; $i < 4; ++$i) { - $hex = $high_part % 0x100; + $hex = (int) (((int) $high_part) % 0x100); $res .= pack('c', $hex); $high_part /= 0x100; } diff --git a/PhpOffice/PhpSpreadsheet/Worksheet/Iterator.php b/PhpOffice/PhpSpreadsheet/Worksheet/Iterator.php index d8797a3..59aa98d 100644 --- a/PhpOffice/PhpSpreadsheet/Worksheet/Iterator.php +++ b/PhpOffice/PhpSpreadsheet/Worksheet/Iterator.php @@ -42,7 +42,7 @@ class Iterator implements \Iterator /** * Rewind iterator. */ - public function rewind() + public function rewind() : void { $this->position = 0; } @@ -52,7 +52,7 @@ class Iterator implements \Iterator * * @return Worksheet */ - public function current() + public function current() : mixed { return $this->subject->getSheet($this->position); } @@ -62,7 +62,7 @@ class Iterator implements \Iterator * * @return int */ - public function key() + public function key() : mixed { return $this->position; } @@ -70,7 +70,7 @@ class Iterator implements \Iterator /** * Next value. */ - public function next() + public function next() : void { ++$this->position; } @@ -80,7 +80,7 @@ class Iterator implements \Iterator * * @return bool */ - public function valid() + public function valid() : bool { return $this->position < $this->subject->getSheetCount() && $this->position >= 0; } diff --git a/PhpOffice/PhpSpreadsheet/Worksheet/RowCellIterator.php b/PhpOffice/PhpSpreadsheet/Worksheet/RowCellIterator.php index 8510d40..ba2a016 100644 --- a/PhpOffice/PhpSpreadsheet/Worksheet/RowCellIterator.php +++ b/PhpOffice/PhpSpreadsheet/Worksheet/RowCellIterator.php @@ -113,7 +113,7 @@ class RowCellIterator extends CellIterator /** * Rewind the iterator to the starting column. */ - public function rewind() + public function rewind() : void { $this->currentColumnIndex = $this->startColumnIndex; } @@ -123,7 +123,7 @@ class RowCellIterator extends CellIterator * * @return \PhpOffice\PhpSpreadsheet\Cell\Cell */ - public function current() + public function current() : mixed { return $this->worksheet->getCellByColumnAndRow($this->currentColumnIndex, $this->rowIndex); } @@ -133,7 +133,7 @@ class RowCellIterator extends CellIterator * * @return string */ - public function key() + public function key() : mixed { return Coordinate::stringFromColumnIndex($this->currentColumnIndex); } @@ -141,7 +141,7 @@ class RowCellIterator extends CellIterator /** * Set the iterator to its next value. */ - public function next() + public function next() : void { do { ++$this->currentColumnIndex; @@ -153,7 +153,7 @@ class RowCellIterator extends CellIterator * * @throws PhpSpreadsheetException */ - public function prev() + public function prev() : void { do { --$this->currentColumnIndex; @@ -165,7 +165,7 @@ class RowCellIterator extends CellIterator * * @return bool */ - public function valid() + public function valid() : bool { return $this->currentColumnIndex <= $this->endColumnIndex && $this->currentColumnIndex >= $this->startColumnIndex; } diff --git a/PhpOffice/PhpSpreadsheet/Worksheet/RowIterator.php b/PhpOffice/PhpSpreadsheet/Worksheet/RowIterator.php index 433cea6..b828306 100644 --- a/PhpOffice/PhpSpreadsheet/Worksheet/RowIterator.php +++ b/PhpOffice/PhpSpreadsheet/Worksheet/RowIterator.php @@ -117,7 +117,7 @@ class RowIterator implements \Iterator /** * Rewind the iterator to the starting row. */ - public function rewind() + public function rewind() : void { $this->position = $this->startRow; } @@ -127,7 +127,7 @@ class RowIterator implements \Iterator * * @return Row */ - public function current() + public function current() : mixed { return new Row($this->subject, $this->position); } @@ -137,7 +137,7 @@ class RowIterator implements \Iterator * * @return int */ - public function key() + public function key() : mixed { return $this->position; } @@ -145,7 +145,7 @@ class RowIterator implements \Iterator /** * Set the iterator to its next value. */ - public function next() + public function next() : void { ++$this->position; } @@ -153,7 +153,7 @@ class RowIterator implements \Iterator /** * Set the iterator to its previous value. */ - public function prev() + public function prev() : void { --$this->position; } @@ -163,7 +163,7 @@ class RowIterator implements \Iterator * * @return bool */ - public function valid() + public function valid() : bool { return $this->position <= $this->endRow && $this->position >= $this->startRow; } diff --git a/PhpOffice/PhpSpreadsheet/Writer/Xlsx/StringTable.php b/PhpOffice/PhpSpreadsheet/Writer/Xlsx/StringTable.php index 19604e4..d86c6b8 100644 --- a/PhpOffice/PhpSpreadsheet/Writer/Xlsx/StringTable.php +++ b/PhpOffice/PhpSpreadsheet/Writer/Xlsx/StringTable.php @@ -42,7 +42,7 @@ class StringTable extends WriterPart if (!is_object($cellValue) && ($cellValue !== null) && $cellValue !== '' && - !isset($aFlippedStringTable[$cellValue]) && + !isset($aFlippedStringTable[\is_float($cellValue) ? (int) $cellValue : $cellValue]) && ($cell->getDataType() == DataType::TYPE_STRING || $cell->getDataType() == DataType::TYPE_STRING2 || $cell->getDataType() == DataType::TYPE_NULL)) { $aStringTable[] = $cellValue; $aFlippedStringTable[$cellValue] = true;