File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
src/JsonSchema/Constraints Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ protected function validatePhone($phone)
173
173
174
174
protected function validateHostname ($ host )
175
175
{
176
- return preg_match ('/^[_a-z]+\.([_a-z]+\.?)+$/i ' , $ host );
176
+ $ hostnameRegex = '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/i ' ;
177
+ return preg_match ($ hostnameRegex , $ host );
177
178
}
178
179
}
Original file line number Diff line number Diff line change @@ -123,6 +123,9 @@ public function getValidFormats()
123
123
array ('::ff ' , 'ipv6 ' ),
124
124
125
125
array ('www.example.com ' , 'host-name ' ),
126
+ array ('3v4l.org ' , 'host-name ' ),
127
+ array ('a-valid-host.com ' , 'host-name ' ),
128
+ array ('localhost ' , 'host-name ' ),
126
129
127
130
array ('anything ' , '* ' ),
128
131
array ('unknown ' , '* ' ),
@@ -166,7 +169,8 @@ public function getInvalidFormats()
166
169
167
170
array (':::ff ' , 'ipv6 ' ),
168
171
169
- array ('localhost ' , 'host-name ' ),
172
+ array ('@localhost ' , 'host-name ' ),
173
+ array ('..nohost ' , 'host-name ' ),
170
174
171
175
);
172
176
}
You can’t perform that action at this time.
0 commit comments