Skip to content

Commit

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

/**
Expand Down
Expand Up @@ -112,7 +112,11 @@ public function getValidUrls()
array('http://username:password@symfony.com'),
array('http://user-name@symfony.com'),
array('http://symfony.com?'),
array('http://symfony.com?query=1'),
array('http://symfony.com/?query=1'),
array('http://symfony.com#'),
array('http://symfony.com#fragment'),
array('http://symfony.com/#fragment'),
);
}

Expand Down

0 comments on commit 2d0af8e

Please sign in to comment.