File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
src/Symfony/Component/BrowserKit Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -676,7 +676,7 @@ protected function getAbsoluteUri($uri)
676
676
}
677
677
678
678
// protocol relative URL
679
- if (str_starts_with ($ uri , '// ' )) {
679
+ if ('' !== trim ( $ uri , ' / ' ) && str_starts_with ($ uri , '// ' )) {
680
680
return parse_url ($ currentUri , \PHP_URL_SCHEME ).': ' .$ uri ;
681
681
}
682
682
Original file line number Diff line number Diff line change @@ -172,6 +172,30 @@ public function testMultiPartRequestWithAdditionalParametersOfTheSameName()
172
172
]);
173
173
}
174
174
175
+ /**
176
+ * @dataProvider forwardSlashesRequestPathProvider
177
+ */
178
+ public function testMultipleForwardSlashesRequestPath (string $ requestPath )
179
+ {
180
+ $ client = $ this ->createMock (HttpClientInterface::class);
181
+ $ client
182
+ ->expects ($ this ->once ())
183
+ ->method ('request ' )
184
+ ->with ('GET ' , 'http://localhost ' .$ requestPath )
185
+ ->willReturn ($ this ->createMock (ResponseInterface::class));
186
+ $ browser = new HttpBrowser ($ client );
187
+ $ browser ->request ('GET ' , $ requestPath );
188
+ }
189
+
190
+ public function forwardSlashesRequestPathProvider ()
191
+ {
192
+ return [
193
+ 'one slash ' => ['/ ' ],
194
+ 'two slashes ' => ['// ' ],
195
+ 'multiple slashes ' => ['//// ' ],
196
+ ];
197
+ }
198
+
175
199
private function uploadFile (string $ data ): string
176
200
{
177
201
$ path = tempnam (sys_get_temp_dir (), 'http ' );
You can’t perform that action at this time.
0 commit comments