Skip to content

Commit b3adba8

Browse files
committed
bug #37379 [HttpClient] Support for cURL handler objects (derrabus)
This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] Support for cURL handler objects | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #37378 | License | MIT | Doc PR | N/A Commits ------- 7ccc2e1 [HttpClient] Support for cURL handler objects.
2 parents aeb0946 + 7ccc2e1 commit b3adba8

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

src/Symfony/Component/HttpClient/CurlHttpClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ public function reset()
337337
$this->multi->dnsCache->evictions = $this->multi->dnsCache->evictions ?: $this->multi->dnsCache->removals;
338338
$this->multi->dnsCache->removals = $this->multi->dnsCache->hostnames = [];
339339

340-
if (\is_resource($this->multi->handle)) {
340+
if (\is_resource($this->multi->handle) || $this->multi->handle instanceof \CurlMultiHandle) {
341341
if (\defined('CURLMOPT_PUSHFUNCTION')) {
342342
curl_multi_setopt($this->multi->handle, CURLMOPT_PUSHFUNCTION, null);
343343
}
@@ -347,7 +347,7 @@ public function reset()
347347
}
348348

349349
foreach ($this->multi->openHandles as [$ch]) {
350-
if (\is_resource($ch)) {
350+
if (\is_resource($ch) || $ch instanceof \CurlHandle) {
351351
curl_setopt($ch, CURLOPT_VERBOSE, false);
352352
}
353353
}

src/Symfony/Component/HttpClient/Internal/CurlClientState.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
final class CurlClientState extends ClientState
2222
{
23-
/** @var resource */
23+
/** @var \CurlMultiHandle|resource */
2424
public $handle;
2525
/** @var PushedResponse[] */
2626
public $pushedResponses = [];

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ final class CurlResponse implements ResponseInterface
3636
private $debugBuffer;
3737

3838
/**
39+
* @param \CurlHandle|resource|string $ch
40+
*
3941
* @internal
4042
*/
4143
public function __construct(CurlClientState $multi, $ch, array $options = null, LoggerInterface $logger = null, string $method = 'GET', callable $resolveRedirect = null, int $curlVersion = null)
4244
{
4345
$this->multi = $multi;
4446

45-
if (\is_resource($ch)) {
47+
if (\is_resource($ch) || $ch instanceof \CurlHandle) {
4648
unset($multi->handlesActivity[(int) $ch]);
4749
$this->handle = $ch;
4850
$this->debugBuffer = fopen('php://temp', 'w+');

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ trait ResponseTrait
5050
'canceled' => false,
5151
];
5252

53-
/** @var resource */
53+
/** @var object|resource */
5454
private $handle;
5555
private $id;
5656
private $timeout = 0;

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