Skip to content

Commit 45b9501

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: Throw exception if incompatible version of psr/simple-cache is used [DependencyInjection] copy synthetic status when resolving child definitions [HttpClient] Fix Failed to open stream: Too many open files [Console] use STDOUT/ERR in ConsoleOutput to save opening too many file descriptors Fix for "Implicit conversion from float <float_number> to int loses precision" Fix typo in UPGRADE-6.0.md [Cache] Set mtime of cache files 1 year into future if they do not expire [DependencyInjection] remove arbitratry limitation to exclude inline services from bindings
2 parents ae38891 + a5a467b commit 45b9501

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

Internal/CurlClientState.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
*/
2424
final class CurlClientState extends ClientState
2525
{
26-
public \CurlMultiHandle $handle;
27-
public \CurlShareHandle $share;
26+
public ?\CurlMultiHandle $handle;
27+
public ?\CurlShareHandle $share;
28+
2829
/** @var PushedResponse[] */
2930
public array $pushedResponses = [];
3031
public DnsCache $dnsCache;
@@ -64,8 +65,17 @@ public function __construct(int $maxHostConnections, int $maxPendingPushes)
6465
return;
6566
}
6667

67-
curl_multi_setopt($this->handle, \CURLMOPT_PUSHFUNCTION, function ($parent, $pushed, array $requestHeaders) use ($maxPendingPushes) {
68-
return $this->handlePush($parent, $pushed, $requestHeaders, $maxPendingPushes);
68+
// Clone to prevent a circular reference
69+
$multi = clone $this;
70+
$multi->handle = null;
71+
$multi->share = null;
72+
$multi->pushedResponses = &$this->pushedResponses;
73+
$multi->logger = &$this->logger;
74+
$multi->handlesActivity = &$this->handlesActivity;
75+
$multi->openHandles = &$this->openHandles;
76+
77+
curl_multi_setopt($this->handle, \CURLMOPT_PUSHFUNCTION, static function ($parent, $pushed, array $requestHeaders) use ($multi, $maxPendingPushes) {
78+
return $multi->handlePush($parent, $pushed, $requestHeaders, $maxPendingPushes);
6979
});
7080
}
7181

0 commit comments

Comments
 (0)