Skip to content

Commit 411f73a

Browse files
Merge branch '5.4' into 6.0
* 5.4: cs fix [Messenger] Fix Doctrine transport on MySQL [Filesystem] Remove needless `mb_*` calls [Translator] Fix translator overlapse [Yaml] Improve test coverage in DumperTest and ParserTest Extract dispatching console signal handling and include subscribers [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 minor: fix test [Serializer] Fix error message remove the ChatterInterface alias when the chatter service is removed Bump Symfony version to 5.4.12 Update VERSION for 5.4.11 Update CHANGELOG for 5.4.11 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 49bef7d + 6a057be commit 411f73a

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
@@ -96,7 +96,7 @@ public function reset()
9696
curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_DNS);
9797
curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_SSL_SESSION);
9898

99-
if (\defined('CURL_LOCK_DATA_CONNECT')) {
99+
if (\defined('CURL_LOCK_DATA_CONNECT') && \PHP_VERSION_ID >= 80000) {
100100
curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_CONNECT);
101101
}
102102
}

Response/StreamWrapper.php

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

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

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

7876
public function getResponse(): ResponseInterface

0 commit comments

Comments
 (0)