Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/PhpSpreadsheet/Calculation/Calculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2861,7 +2861,8 @@ public function clearCalculationCacheForWorksheet($worksheetName): void
*/
public function renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksheetName): void
{
if (isset($this->calculationCache[$fromWorksheetName])) {
// PHP 8.5: avoid using null as an array offset, coerce to empty string instead
if (isset($this->calculationCache[$fromWorksheetName ?? ''])) {
$this->calculationCache[$toWorksheetName] = &$this->calculationCache[$fromWorksheetName];
unset($this->calculationCache[$fromWorksheetName]);
}
Expand Down
5 changes: 3 additions & 2 deletions src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ private function readColumnAttributes(SimpleXMLElement $worksheetCols, $readData
foreach ($worksheetCols->col as $column) {
$startColumn = Coordinate::stringFromColumnIndex((int) $column['min']);
$endColumn = Coordinate::stringFromColumnIndex((int) $column['max']);
++$endColumn;
for ($columnAddress = $startColumn; $columnAddress !== $endColumn; ++$columnAddress) {
// PHP 8.5: avoid increment on non-numeric string, use column helper instead
$endColumn = Coordinate::stringFromColumnIndex(Coordinate::columnIndexFromString($endColumn) + 1);
for ($columnAddress = $startColumn; $columnAddress !== $endColumn; $columnAddress = Coordinate::stringFromColumnIndex(Coordinate::columnIndexFromString($columnAddress) + 1)) {
$columnAttributes[$columnAddress] = $this->readColumnRangeAttributes($column, $readDataOnly);

if ((int) ($column['max']) == 16384) {
Expand Down
6 changes: 4 additions & 2 deletions src/PhpSpreadsheet/Worksheet/Worksheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -2503,14 +2503,16 @@ public function rangeToArray($pRange, $nullValue = null, $calculateFormulas = tr
$maxCol = Coordinate::stringFromColumnIndex($rangeEnd[0]);
$maxRow = $rangeEnd[1];

++$maxCol;
// PHP 8.5: avoid increment on non-numeric string, use column helper instead
$maxCol = Coordinate::stringFromColumnIndex(Coordinate::columnIndexFromString($maxCol) + 1);
// Loop through rows
$r = -1;
for ($row = $minRow; $row <= $maxRow; ++$row) {
$rRef = $returnCellRef ? $row : ++$r;
$c = -1;
// Loop through columns in the current row
for ($col = $minCol; $col != $maxCol; ++$col) {
// PHP 8.5: avoid increment on non-numeric string, use column helper instead
for ($col = $minCol; $col != $maxCol; $col = Coordinate::stringFromColumnIndex(Coordinate::columnIndexFromString($col) + 1)) {
$cRef = $returnCellRef ? $col : ++$c;
// Using getCell() will create a new cell if it doesn't already exist. We don't want that to happen
// so we test and retrieve directly against cellCollection
Expand Down
Loading