Switch to is_string native method

This commit is contained in:
apetitpa 2017-03-24 16:26:16 +01:00 committed by Fabien Potencier
parent 6071ff6c8f
commit 91b665c12a

View File

@ -80,7 +80,7 @@ class UrlValidator extends ConstraintValidator
if ($constraint->checkDNS) { if ($constraint->checkDNS) {
$host = parse_url($value, PHP_URL_HOST); $host = parse_url($value, PHP_URL_HOST);
if ('' === $host || !checkdnsrr($host, 'ANY')) { if (!is_string($host) || !checkdnsrr($host, 'ANY')) {
if ($this->context instanceof ExecutionContextInterface) { if ($this->context instanceof ExecutionContextInterface) {
$this->context->buildViolation($constraint->dnsMessage) $this->context->buildViolation($constraint->dnsMessage)
->setParameter('{{ value }}', $this->formatValue($host)) ->setParameter('{{ value }}', $this->formatValue($host))