Skip to content

Commit

Permalink
Fixed regex in hostname validator
Browse files Browse the repository at this point in the history
  • Loading branch information
TimZ99 committed Sep 6, 2018
1 parent ed61b38 commit 1d0f6a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/psm/Util/Server/ServerValidator.php
Expand Up @@ -96,7 +96,7 @@ public function ip($value, $type = null) {
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;
}
Expand Down

0 comments on commit 1d0f6a6

Please sign in to comment.