Skip to content

Commit 464a47d

Browse files
github-actions[bot]claude
authored andcommitted
(fix): CI — restore JSON decode for indexes in SQLite deleteAttribute/renameIndex
deleteAttribute and renameIndex call $this->getDocument(metadata, ...) on the adapter directly, which doesn't apply the metadata 'json' filter — so $collection->getAttribute('indexes', []) returns the raw JSON string from the column. Commit 59c363c removed the json_decode under the assumption the value was always pre-decoded; that's only true when loaded via Database::getCollection(). The TypeError thrown from foreach() over a string surfaced as testPurgeCollectionCache failing, and worse, testEvents threw before its $database->on(..., null) cleanup ran — leaking the EVENT_ALL listener into every later test that triggered an event, which is why 306 tests on SQLite started asserting '' matches null at CollectionTests.php:1532. Decode only when the value is still a string so both call paths work. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 18a995b commit 464a47d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/Database/Adapter/SQLite.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,9 @@ public function deleteAttribute(string $collection, string $id, bool $array = fa
612612
}
613613

614614
$indexes = $collection->getAttribute('indexes', []);
615+
if (\is_string($indexes)) {
616+
$indexes = \json_decode($indexes, true) ?? [];
617+
}
615618

616619
foreach ($indexes as $index) {
617620
$attributes = $index['attributes'];
@@ -662,6 +665,9 @@ public function renameIndex(string $collection, string $old, string $new): bool
662665
$old = $this->filter($old);
663666
$new = $this->filter($new);
664667
$indexes = $collection->getAttribute('indexes', []);
668+
if (\is_string($indexes)) {
669+
$indexes = \json_decode($indexes, true) ?? [];
670+
}
665671
$index = null;
666672

667673
foreach ($indexes as $node) {

0 commit comments

Comments
 (0)