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 5607f71

Browse filesBrowse files
committed
bug #14785 [BrowserKit] Fix bug when uri starts with http. (amouhzi)
This PR was merged into the 2.3 branch. Discussion ---------- [BrowserKit] Fix bug when uri starts with http. | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Commits ------- 6d3ec63 [BrowserKit] Fix bug when uri starts with http.
2 parents 013009b + 6d3ec63 commit 5607f71
Copy full SHA for 5607f71

File tree

Expand file treeCollapse file tree

2 files changed

+16
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-1
lines changed

‎src/Symfony/Component/BrowserKit/Client.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/BrowserKit/Client.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ public function restart()
556556
protected function getAbsoluteUri($uri)
557557
{
558558
// already absolute?
559-
if (0 === strpos($uri, 'http')) {
559+
if (0 === strpos($uri, 'http://') || 0 === strpos($uri, 'https://')) {
560560
return $uri;
561561
}
562562

‎src/Symfony/Component/BrowserKit/Tests/ClientTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/BrowserKit/Tests/ClientTest.php
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,21 @@ public function testRequestURIConversion()
207207
$client->request('GET', 'http://www.example.com/foo/foobar');
208208
$client->request('GET', 'bar');
209209
$this->assertEquals('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
210+
211+
$client = new TestClient();
212+
$client->request('GET', 'http://www.example.com/foo/');
213+
$client->request('GET', 'http');
214+
$this->assertEquals('http://www.example.com/foo/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
215+
216+
$client = new TestClient();
217+
$client->request('GET', 'http://www.example.com/foo');
218+
$client->request('GET', 'http/bar');
219+
$this->assertEquals('http://www.example.com/http/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
220+
221+
$client = new TestClient();
222+
$client->request('GET', 'http://www.example.com/');
223+
$client->request('GET', 'http');
224+
$this->assertEquals('http://www.example.com/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
210225
}
211226

212227
public function testRequestURIConversionByServerHost()

0 commit comments

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