Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 692eace

Browse filesBrowse files
committed
Merge branch '4.4' into 5.3
* 4.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 [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 50e00e4 + 8129ccd commit 692eace
Copy full SHA for 692eace

File tree

1 file changed

+13
-4
lines changed
Filter options

1 file changed

+13
-4
lines changed

‎Internal/CurlClientState.php

Copy file name to clipboardExpand all lines: Internal/CurlClientState.php
+13-4Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
*/
2424
final class CurlClientState extends ClientState
2525
{
26-
/** @var \CurlMultiHandle|resource */
26+
/** @var \CurlMultiHandle|resource|null */
2727
public $handle;
28-
/** @var \CurlShareHandle|resource */
28+
/** @var \CurlShareHandle|resource|null */
2929
public $share;
3030
/** @var PushedResponse[] */
3131
public $pushedResponses = [];
@@ -68,8 +68,17 @@ public function __construct(int $maxHostConnections, int $maxPendingPushes)
6868
return;
6969
}
7070

71-
curl_multi_setopt($this->handle, \CURLMOPT_PUSHFUNCTION, function ($parent, $pushed, array $requestHeaders) use ($maxPendingPushes) {
72-
return $this->handlePush($parent, $pushed, $requestHeaders, $maxPendingPushes);
71+
// Clone to prevent a circular reference
72+
$multi = clone $this;
73+
$multi->handle = null;
74+
$multi->share = null;
75+
$multi->pushedResponses = &$this->pushedResponses;
76+
$multi->logger = &$this->logger;
77+
$multi->handlesActivity = &$this->handlesActivity;
78+
$multi->openHandles = &$this->openHandles;
79+
80+
curl_multi_setopt($this->handle, \CURLMOPT_PUSHFUNCTION, static function ($parent, $pushed, array $requestHeaders) use ($multi, $maxPendingPushes) {
81+
return $multi->handlePush($parent, $pushed, $requestHeaders, $maxPendingPushes);
7382
});
7483
}
7584

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.