Skip to content

Commit

Permalink
[Validator] Allow an empty path in a URL with only a fragment or a query
Browse files Browse the repository at this point in the history
  • Loading branch information
jakzal committed Oct 16, 2015
1 parent 751f2be commit b3a5411
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -33,7 +33,7 @@ class UrlValidator extends ConstraintValidator
\] # a IPv6 address
)
(:[0-9]+)? # a port (optional)
(/?|/\S+) # a /, nothing or a / with something
(/?|/\S+|\?|\#) # a /, nothing, a / with something, a query or a fragment
$~ixu';

/**
Expand Down
Expand Up @@ -111,6 +111,8 @@ public function getValidUrls()
array('http://☎.com/'),
array('http://username:password@symfony.com'),
array('http://user-name@symfony.com'),
array('http://symfony.com?'),
array('http://symfony.com#'),
);
}

Expand Down Expand Up @@ -140,8 +142,6 @@ public function getInvalidUrls()
array('http://goog_le.com'),
array('http://google.com::aa'),
array('http://google.com:aa'),
array('http://symfony.com?'),
array('http://symfony.com#'),
array('ftp://google.fr'),
array('faked://google.fr'),
array('http://127.0.0.1:aa/'),
Expand Down

0 comments on commit b3a5411

Please sign in to comment.