Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f2e8722

Browse filesBrowse 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
Copy full SHA for f2e8722

File tree

2 files changed

+5
-1
lines changed
Filter options

2 files changed

+5
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraints/UrlValidator.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
+4Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.