Skip to content

Commit 325a0f8

Browse files
kekko1212bighappyface
authored andcommitted
Fix regex for Rfc3339 validation (#347)
1 parent d39c56a commit 325a0f8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/JsonSchema/Rfc3339.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class Rfc3339
66
{
7-
const REGEX = '/(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))/';
7+
const REGEX = '/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
88

99
/**
1010
* Try creating a DateTime instance

tests/Constraints/FormatTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ public function getInvalidFormats()
150150
array('00:00:60', 'time'),
151151
array('25:00:00', 'time'),
152152

153+
154+
array('invalid_value_2000-05-01T12:12:12Z', 'date-time'),
155+
array('2000-05-01T12:12:12Z_invalid_value', 'date-time'),
153156
array('1999-1-11T00:00:00Z', 'date-time'),
154157
array('1999-01-11T00:00:00+100', 'date-time'),
155158
array('1999-01-11T00:00:00+1:00', 'date-time'),

0 commit comments

Comments
 (0)