8000 bug #16537 [Validator] Allow an empty path with a non empty fragment … · symfony/symfony@f2e8722 · GitHub
[go: up one dir, main page]

Skip to content

Commit f2e8722

Browse files
committed
bug #16537 [Validator] Allow an empty path with a non empty fragment or a query (jakzal)
This PR was merged into the 2.3 branch. Discussion ---------- [Validator] Allow an empty path with a non empty fragment or a query | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #16536 | License | MIT | Doc PR | - #16259 didn't fully fix the issue. Commits ------- 2d0af8e [Validator] Allow an empty path with a non empty fragment or a query
2 parents ec39f9d + 2d0af8e commit f2e8722

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Symfony/Component/Validator/Constraints/UrlValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class UrlValidator extends ConstraintValidator
3333
\] # a IPv6 address
3434
)
3535
(:[0-9]+)? # a port (optional)
36-
(/?|/\S+|\?|\#) # a /, nothing, a / with something, a query or a fragment
36+
(/?|/\S+|\?\S*|\#\S*) # a /, nothing, a / with something, a query or a fragment
3737
$~ixu';
3838

3939
/**

src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ public function getValidUrls()
112112
array('http://username:password@symfony.com'),
113113
array('http://user-name@symfony.com'),
114114
array('http://symfony.com?'),
115+
array('http://symfony.com?query=1'),
116+
array('http://symfony.com/?query=1'),
115117
array('http://symfony.com#'),
118+
array('http://symfony.com#fragment'),
119+
array('http://symfony.com/#fragment'),
116120
);
117121
}
118122

0 commit comments

Comments
 (0)
0