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 9e7c254

Browse filesBrowse files
committed
bug #34366 [HttpFoundation] Allow redirecting to URLs that contain a semicolon (JayBizzle)
This PR was merged into the 3.4 branch. Discussion ---------- [HttpFoundation] Allow redirecting to URLs that contain a semicolon | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | no | New feature? | no | Deprecations? | no | License | MIT URLs that contain a semicolon cannot be redirected to at least in MS Edge and IE10. Take the following example... ``` # https://ad.doubleclick.net/ddm/clk/450721234;254801234;l // After redirect... # https://ad.doubleclick.net/ddm/clk/450721234 ``` Wrapping the URL in single quotes fixes the issue ([related reading](https://www.w3.org/TR/WCAG20-TECHS/H76.html)) Commits ------- bd0637e [HttpFoundation] Allow redirecting to URLs that contain a semicolon
2 parents eaca085 + bd0637e commit 9e7c254
Copy full SHA for 9e7c254

File tree

2 files changed

+2
-5
lines changed
Filter options

2 files changed

+2
-5
lines changed

‎src/Symfony/Component/HttpFoundation/RedirectResponse.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/RedirectResponse.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function setTargetUrl($url)
9393
<html>
9494
<head>
9595
<meta charset="UTF-8" />
96-
<meta http-equiv="refresh" content="0;url=%1$s" />
96+
<meta http-equiv="refresh" content="0;url=\'%1$s\'" />
9797
9898
<title>Redirecting to %1$s</title>
9999
</head>

‎src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ public function testGenerateMetaRedirect()
2020
{
2121
$response = new RedirectResponse('foo.bar');
2222

23-
$this->assertEquals(1, preg_match(
24-
'#<meta http-equiv="refresh" content="\d+;url=foo\.bar" />#',
25-
preg_replace(['/\s+/', '/\'/'], [' ', '"'], $response->getContent())
26-
));
23+
$this->assertRegExp('#<meta http-equiv="refresh" content="\d+;url=\'foo\.bar\'" />#', preg_replace('/\s+/', ' ', $response->getContent()));
2724
}
2825

2926
public function testRedirectResponseConstructorNullUrl()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.