8000 [HttpClient] disable debug log with curl 7.64.0 · symfony/symfony@d4cde31 · GitHub
[go: up one dir, main page]

Skip to content

Commit d4cde31

Browse files
[HttpClient] disable debug log with curl 7.64.0
1 parent d0b7445 commit d4cde31

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/Symfony/Component/HttpClient/CurlHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public function request(string $method, string $url, array $options = []): Respo
308308
}
309309
}
310310

311-
return $pushedResponse ?? new CurlResponse($this->multi, $ch, $options, $this->logger, $method, self::createRedirectResolver($options, $host));
311+
return $pushedResponse ?? new CurlResponse($this->multi, $ch, $options, $this->logger, $method, self::createRedirectResolver($options, $host), self::$curlVersion['version_number']);
312312
}
313313

314314
/**

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,19 @@ final class CurlResponse implements ResponseInterface
3737
/**
3838
* @internal
3939
*/
40-
public function __construct(CurlClientState $multi, $ch, array $options = null, LoggerInterface $logger = null, string $method = 'GET', callable $resolveRedirect = null)
40+
public function __construct(CurlClientState $multi, $ch, array $options = null, LoggerInterface $logger = null, string $method = 'GET', callable $resolveRedirect = null, int $curlVersion = null)
4141
{
4242
$this->multi = $multi;
4343

4444
if (\is_resource($ch)) {
4545
$this->handle = $ch;
4646
$this->debugBuffer = fopen('php://temp', 'w+');
47-
curl_setopt($ch, CURLOPT_VERBOSE, true);
48-
curl_setopt($ch, CURLOPT_STDERR, $this->debugBuffer);
47+
if (0x074000 === $curlVersion) {
48+
fwrite($this->debugBuffer, 'Due to a bug in curl 7.64.0, the debug log is disabled; use another version to work around the issue.');
49+
} else {
50+
curl_setopt($ch, CURLOPT_VERBOSE, true);
51+
curl_setopt($ch, CURLOPT_STDERR, $this->debugBuffer);
52+
}
4953
} else {
5054
$this->info['url'] = $ch;
5155
$ch = $this->handle;

0 commit comments

Comments
 (0)
0