Skip to content

Commit 48ddde4

Browse files
bug #62503 [HttpClient] Fix releasing uploaded stream resources (nicolas-grekas)
This PR was merged into the 6.4 branch. Discussion ---------- [HttpClient] Fix releasing uploaded stream resources | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #60506 | License | MIT The recursive closure kept $streams (and therefore the original resources) reachable until the GC cycle collector ran, so multipart uploads held file handles even after the request lifecyle ended. Setting $caster = null breaks the cycle immediately, letting the resources be released right after the request. Commits ------- 9fc5ab8 [HttpClient] Fix releasing uploaded stream resources
2 parents ea7eb35 + 9fc5ab8 commit 48ddde4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/Symfony/Component/HttpClient/HttpClientTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ private static function normalizeBody($body, array &$normalizedHeaders = [])
355355
}
356356
}
357357
});
358+
$caster = null;
358359

359360
if ('' === $body = http_build_query($body, '', '&')) {
360361
return '';

0 commit comments

Comments
 (0)