Skip to content

Commit

Permalink
Merge branch '4.4' into 5.4
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nicolas-grekas committed Aug 2, 2022
2 parents 5c5c37e + 9f9dd96 commit 6a057be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Internal/CurlClientState.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function reset()
curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_DNS);
curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_SSL_SESSION);

if (\defined('CURL_LOCK_DATA_CONNECT')) {
if (\defined('CURL_LOCK_DATA_CONNECT') && \PHP_VERSION_ID >= 80000) {
curl_share_setopt($this->share, \CURLSHOPT_SHARE, \CURL_LOCK_DATA_CONNECT);
}
}
Expand Down
20 changes: 9 additions & 11 deletions Response/StreamWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,18 @@ public static function createResource(ResponseInterface $response, HttpClientInt
throw new \InvalidArgumentException(sprintf('Providing a client to "%s()" is required when the response doesn\'t have any "stream()" method.', __CLASS__));
}

if (false === stream_wrapper_register('symfony', __CLASS__)) {
static $registered = false;

if (!$registered = $registered || stream_wrapper_register(strtr(__CLASS__, '\\', '-'), __CLASS__)) {
throw new \RuntimeException(error_get_last()['message'] ?? 'Registering the "symfony" stream wrapper failed.');
}

try {
$context = [
'client' => $client ?? $response,
'response' => $response,
];

return fopen('symfony://'.$response->getInfo('url'), 'r', false, stream_context_create(['symfony' => $context])) ?: null;
} finally {
stream_wrapper_unregister('symfony');
}
$context = [
'client' => $client ?? $response,
'response' => $response,
];

return fopen(strtr(__CLASS__, '\\', '-').'://'.$response->getInfo('url'), 'r', false, stream_context_create(['symfony' => $context]));
}

public function getResponse(): ResponseInterface
Expand Down

0 comments on commit 6a057be

Please sign in to comment.