Skip to content

Commit e135e51

Browse files
abnegateclaude
andcommitted
fix: use loose comparison only for VAR_ID type attributes in update check
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e7edc9c commit e135e51

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/Database/Database.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6059,10 +6059,19 @@ public function updateDocument(string $collection, string $id, Document $documen
60596059
}
60606060
$document = new Document($document);
60616061

6062-
$relationships = \array_filter($collection->getAttribute('attributes', []), function ($attribute) {
6062+
$attributes = $collection->getAttribute('attributes', []);
6063+
6064+
$relationships = \array_filter($attributes, function ($attribute) {
60636065
return $attribute['type'] === Database::VAR_RELATIONSHIP;
60646066
});
60656067

6068+
$idAttributes = [];
6069+
foreach (\array_merge(self::INTERNAL_ATTRIBUTES, $attributes) as $attribute) {
6070+
if ($attribute['type'] === Database::VAR_ID) {
6071+
$idAttributes[$attribute['$id']] = true;
6072+
}
6073+
}
6074+
60666075
$shouldUpdate = false;
60676076

60686077
if ($collection->getId() !== self::METADATA) {
@@ -6160,7 +6169,8 @@ public function updateDocument(string $collection, string $id, Document $documen
61606169

61616170
$oldValue = $old->getAttribute($key);
61626171

6163-
if ($value != $oldValue) {
6172+
$isIdType = isset($idAttributes[$key]);
6173+
if ($isIdType ? $value != $oldValue : $value !== $oldValue) {
61646174
$shouldUpdate = true;
61656175
break;
61666176
}

0 commit comments

Comments
 (0)