Skip to content

Commit 2444fe6

Browse files
abnegateclaude
andcommitted
(fix): handle millisecond timestamp strings in Mongo castingBefore
When castingBefore receives a numeric string (millisecond timestamp) for a Datetime column, pass it directly to UTCDateTime instead of routing through NativeDateTime which rejects raw numeric strings. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 146221a commit 2444fe6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/Database/Adapter/Mongo.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2532,7 +2532,11 @@ public function castingBefore(Document $collection, Document $document): Documen
25322532
if (! ($node instanceof UTCDateTime)) {
25332533
/** @var mixed $node */
25342534
$nodeStr = \is_string($node) ? $node : (\is_scalar($node) ? (string) $node : '');
2535-
$node = new UTCDateTime(new NativeDateTime($nodeStr));
2535+
if (\is_numeric($nodeStr)) {
2536+
$node = new UTCDateTime((int) $nodeStr);
2537+
} else {
2538+
$node = new UTCDateTime(new NativeDateTime($nodeStr));
2539+
}
25362540
}
25372541
break;
25382542
case ColumnType::Object:

0 commit comments

Comments
 (0)