Fixed regex in hostname validator
parent
ed61b3854f
commit
1d0f6a6986
|
@ -96,7 +96,7 @@ class ServerValidator {
|
|||
case 'ping':
|
||||
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)
|
||||
&& !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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue