Skip to content

Commit 7ce6078

Browse files
Merge branch '7.1' into 7.2
* 7.1: [HttpClient] Fix processing a NativeResponse after its client has been reset [Security] Throw an explicit error when authenticating a token with a null user translation to hebrew
2 parents 7ec3f97 + 71632c1 commit 7ce6078

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

Response/NativeResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function __construct(
8080
};
8181

8282
$this->canary = new Canary(static function () use ($multi, $id) {
83-
if (null !== ($host = $multi->openHandles[$id][6] ?? null) && 0 >= --$multi->hosts[$host]) {
83+
if (null !== ($host = $multi->openHandles[$id][6] ?? null) && isset($multi->hosts[$host]) && 0 >= --$multi->hosts[$host]) {
8484
unset($multi->hosts[$host]);
8585
}
8686
unset($multi->openHandles[$id], $multi->handlesActivity[$id]);
@@ -303,7 +303,7 @@ private static function perform(ClientState $multi, ?array &$responses = null):
303303

304304
$multi->handlesActivity[$i][] = null;
305305
$multi->handlesActivity[$i][] = $e;
306-
if (null !== ($host = $multi->openHandles[$i][6] ?? null) && 0 >= --$multi->hosts[$host]) {
306+
if (null !== ($host = $multi->openHandles[$i][6] ?? null) && isset($multi->hosts[$host]) && 0 >= --$multi->hosts[$host]) {
307307
unset($multi->hosts[$host]);
308308
}
309309
unset($multi->openHandles[$i]);

Tests/HttpClientTestCase.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,19 @@ public function testPostToGetRedirect(int $status)
701701
$this->assertSame('/', $body['REQUEST_URI']);
702702
}
703703

704+
public function testResponseCanBeProcessedAfterClientReset()
705+
{
706+
$client = $this->getHttpClient(__FUNCTION__);
707+
$response = $client->request('GET', 'http://127.0.0.1:8057/timeout-body');
708+
$stream = $client->stream($response);
709+
710+
$response->getStatusCode();
711+
$client->reset();
712+
$stream->current();
713+
714+
$this->addToAssertionCount(1);
715+
}
716+
704717
public function testUnixSocket()
705718
{
706719
if (!file_exists('/var/run/docker.sock')) {

0 commit comments

Comments
 (0)