Skip to content

Commit 98acf1c

Browse files
committed
bug #37400 [HttpClient] unset activity list when creating CurlResponse (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] unset activity list when creating CurlResponse | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - This might fix an error that looks like a race condition. I've seen it, and @Toflar too, but we're unable to reproduce. > Argument 2 passed to Symfony\Component\HttpClient\Chunk\DataChunk::__construct() must be of the type string, null given This patch tentatively empties activity lists. If the issue is related to the PHP engine reusing resource ids, this will fix it. Otherwise, we'll know we'll have to look elsewhere. > looking at https://github.com/symfony/http-client/blob/4.4/Response/ResponseTrait.php#L363 I don’t really see how this can happen other than inflate_add() returning null > $response->inflate is true before becoming a resource; there must be a race condition in the curl client that ends up listing a data chunk before a FirstChunk in the activity list, which would explain why inflate_add is given a non-resource (`true`). Commits ------- b249f00 [HttpClient] unset activity list when creating CurlResponse
2 parents 030b10c + b249f00 commit 98acf1c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/Symfony/Component/HttpClient/Response/CurlResponse.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function __construct(CurlClientState $multi, $ch, array $options = null,
4343
$this->multi = $multi;
4444

4545
if (\is_resource($ch)) {
46+
unset($multi->handlesActivity[(int) $ch]);
4647
$this->handle = $ch;
4748
$this->debugBuffer = fopen('php://temp', 'w+');
4849
if (0x074000 === $curlVersion) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy