Fixed regex in hostname validator

This commit is contained in:
TimZ99 2018-09-07 00:38:52 +02:00
parent ed61b3854f
commit 1d0f6a6986
No known key found for this signature in database
GPG Key ID: 4D8268DC68E8339D
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}