Skip to content

Commit 5474bd7

Browse files
committed
Fix cells cache not being reset when sorting the index
1 parent 7850daa commit 5474bd7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/PhpSpreadsheet/Collection/Cells.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ public function getSortedCoordinates(): array
165165
if (!$this->indexSorted) {
166166
asort($this->index);
167167
$this->indexSorted = true;
168+
// Clear unsorted cache
169+
$this->indexKeysCache = null;
170+
$this->indexValuesCache = null;
168171
}
169172

170173
// Build or rebuild index keys cache
@@ -185,6 +188,9 @@ public function getSortedCoordinatesInt(): array
185188
if (!$this->indexSorted) {
186189
asort($this->index);
187190
$this->indexSorted = true;
191+
// Clear unsorted cache
192+
$this->indexKeysCache = null;
193+
$this->indexValuesCache = null;
188194
}
189195

190196
if ($this->indexValuesCache === null) {

0 commit comments

Comments
 (0)