ServerValidator did not allow domains for services

This commit is contained in:
Pepijn Over 2014-07-28 11:38:12 +02:00
parent b79fbafe47
commit 11900a55b3
1 changed files with 5 additions and 1 deletions

View File

@ -93,7 +93,11 @@ class ServerValidator {
}
break;
case 'service':
if(!filter_var($value, FILTER_VALIDATE_IP)) {
if(
!filter_var($value, FILTER_VALIDATE_IP)
// domain regex as per http://stackoverflow.com/questions/106179/regular-expression-to-match-hostname-or-ip-address :
&& !preg_match("/^(([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])/", $value)
) {
throw new \InvalidArgumentException('server_ip_bad_service');
}
break;