Skip to content

Commit ba10eb6

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: Update ExceptionInterface.php Revert removal of Stringable check Flush with flush() after ob_end_flush() [Validator] : Fix "PHP Warning: Undefined array key 1" in NotCompromisedPasswordValidator [Validator] Fix traverse option on Valid constraint when used as Attribute [HttpFoundation] Fix deleteFileAfterSend on client abortion Prevent that bad Ignore method annotations lead to incorrect results also fix the test fix deprecation fix sending request to paths containing multiple slashes Fix generated validation error message for wrong exception mapping status code
2 parents 0ec66df + a19f3c7 commit ba10eb6

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

AbstractBrowser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ protected function getAbsoluteUri(string $uri): string
618618
}
619619

620620
// protocol relative URL
621-
if (0 === strpos($uri, '//')) {
621+
if ('' !== trim($uri, '/') && str_starts_with($uri, '//')) {
622622
return parse_url($currentUri, \PHP_URL_SCHEME).':'.$uri;
623623
}
624624

Tests/HttpBrowserTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,30 @@ public function testMultiPartRequestWithAdditionalParametersOfTheSameName()
180180
]);
181181
}
182182

183+
/**
184+
* @dataProvider forwardSlashesRequestPathProvider
185+
*/
186+
public function testMultipleForwardSlashesRequestPath(string $requestPath)
187+
{
188+
$client = $this->createMock(HttpClientInterface::class);
189+
$client
190+
->expects($this->once())
191+
->method('request')
192+
->with('GET', 'http://localhost'.$requestPath)
193+
->willReturn($this->createMock(ResponseInterface::class));
194+
$browser = new HttpBrowser($client);
195+
$browser->request('GET', $requestPath);
196+
}
197+
198+
public function forwardSlashesRequestPathProvider()
199+
{
200+
return [
201+
'one slash' => ['/'],
202+
'two slashes' => ['//'],
203+
'multiple slashes' => ['////'],
204+
];
205+
}
206+
183207
private function uploadFile(string $data): string
184208
{
185209
$path = tempnam(sys_get_temp_dir(), 'http');

0 commit comments

Comments
 (0)