8000 Don't unset the inflate resource on close as it might still be needed · symfony/symfony@8fa4f85 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8fa4f85

Browse files
committed
Don't unset the inflate resource on close as it might still be needed
1 parent 1cef665 commit 8fa4f85

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ public function __destruct()
225225
*/
226226
private function close(): void
227227
{
228-
$this->inflate = null;
229228
unset($this->multi->openHandles[$this->id], $this->multi->handlesActivity[$this->id]);
230229
curl_setopt($this->handle, \CURLOPT_PRIVATE, '_0');
231230

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ private function open(): void
193193
private function close(): void
194194
{
195195
unset($this->multi->openHandles[$this->id], $this->multi->handlesActivity[$this->id]);
196-
$this->handle = $this->buffer = $this->inflate = $this->onProgress = null;
196+
$this->handle = $this->buffer = $this->onProgress = null;
197197
}
198198

199199
/**

src/Symfony/Contracts/HttpClient/Test/Fixtures/web/index.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@
6363
header('Content-Type: application/json', true, 404);
6464
break;
6565

66+
case '/404-gzipped':
67+
header('Content-Type: text/plain', true, 404);
68+
ob_start('ob_gzhandler');
69+
echo 'some text';
70+
exit;
71+
6672
case '/301':
6773
if ('Basic Zm9vOmJhcg==' === $vars['HTTP_AUTHORIZATION']) {
6874
header('Location: http://127.0.0.1:8057/302', true, 301);

src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,18 @@ public function testGetContentAfterDestruct()
835835
}
836836 95EA
}
837837

838+
public function testGetEncodedContentAfterDestruct()
839+
{
840+
$client = $this->getHttpClient(__FUNCTION__);
841+
842+
try {
843+
$client->request('GET', 'http://localhost:8057/404-gzipped');
844+
$this->fail(ClientExceptionInterface::class.' expected');
845+
} catch (ClientExceptionInterface $e) {
846+
$this->assertSame('some text', $e->getResponse()->getContent(false));
847+
}
848+
}
849+
838850
public function testProxy()
839851
{
840852
$client = $this->getHttpClient(__FUNCTION__);

0 commit comments

Comments
 (0)
0