Skip to content

Commit 6a057be

Browse files
Merge branch '4.4' into 5.4
* 4.4: cs fix [Messenger] Fix Doctrine transport on MySQL [Translator] Fix translator overlapse [Yaml] Improve test coverage in DumperTest and ParserTest [Mailer] Fix error message in case of an STMP error [HttpClient] Fix shared connections not being freed on PHP < 8 [HttpFoundation] Fix invalid ID not regenerated with native PHP file sessions [HttpClient] Fix memory leak when using StreamWrapper Bump Symfony version to 4.4.45 Update VERSION for 4.4.44 Update CONTRIBUTORS for 4.4.44 Update CHANGELOG for 4.4.44
2 parents 5c5c37e + 9f9dd96 commit 6a057be

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

Internal/CurlClientState.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function reset()
9999
curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_DNS);
100100
curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_SSL_SESSION);
101101

102-
if (\defined('CURL_LOCK_DATA_CONNECT')) {
102+
if (\defined('CURL_LOCK_DATA_CONNECT') && \PHP_VERSION_ID >= 80000) {
103103
curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_CONNECT);
104104
}
105105
}

Response/StreamWrapper.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,18 @@ public static function createResource(ResponseInterface $response, HttpClientInt
6161
throw new \InvalidArgumentException(sprintf('Providing a client to "%s()" is required when the response doesn\'t have any "stream()" method.', __CLASS__));
6262
}
6363

64-
if (false === stream_wrapper_register('symfony', __CLASS__)) {
64+
static $registered = false;
65+
66+
if (!$registered = $registered || stream_wrapper_register(strtr(__CLASS__, '\\', '-'), __CLASS__)) {
6567
throw new \RuntimeException(error_get_last()['message'] ?? 'Registering the "symfony" stream wrapper failed.');
6668
}
6769

68-
try {
69-
$context = [
70-
'client' => $client ?? $response,
71-
'response' => $response,
72-
];
73-
74-
return fopen('symfony://'.$response->getInfo('url'), 'r', false, stream_context_create(['symfony' => $context])) ?: null;
75-
} finally {
76-
stream_wrapper_unregister('symfony');
77-
}
70+
$context = [
71+
'client' => $client ?? $response,
72+
'response' => $response,
73+
];
74+
75+
return fopen(strtr(__CLASS__, '\\', '-').'://'.$response->getInfo('url'), 'r', false, stream_context_create(['symfony' => $context]));
7876
}
7977

8078
public function getResponse(): ResponseInterface

0 commit comments

Comments
 (0)