[Validator] Allow an empty path with a non empty fragment or a query
This commit is contained in:
parent
ec39f9da5d
commit
2d0af8e719
|
@ -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';
|
||||
|
||||
/**
|
||||
|
|
|
@ -112,7 +112,11 @@ class UrlValidatorTest extends AbstractConstraintValidatorTest
|
|||
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'),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue