Skip to content

Commit 2522cb1

Browse files
abnegateclaude
andcommitted
fix: guard preg_match from integer input in UUID7 validation
preg_match expects string but Sequence now accepts int|string. Add is_string check so integer values skip regex and fall through to Range validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d195b21 commit 2522cb1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Database/Validator/Sequence.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function isValid($value): bool
4747

4848
switch ($this->idAttributeType) {
4949
case Database::VAR_UUID7:
50-
if (preg_match('/^[a-f0-9]{8}-[a-f0-9]{4}-7[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i', $value) === 1) {
50+
if (\is_string($value) && preg_match('/^[a-f0-9]{8}-[a-f0-9]{4}-7[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i', $value) === 1) {
5151
return true;
5252
}
5353
// Also accept integer IDs (e.g. $tenant may be an integer in any adapter)

0 commit comments

Comments
 (0)