Skip to content

Commit bbd1f60

Browse files
minor #44533 curl_multi_exec errors should not be ignored? (divinity76)
This PR was squashed before being merged into the 4.4 branch. Discussion ---------- curl_multi_exec errors should not be ignored? | Q | A | ------------- | --- | Branch? | 4.4 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> curl_multi_exec errors should not be ignored, but i'm not exactly sure how they should be handled either, so i just throw a RuntimeException, any suggestions? in any case, these errors should be exceedingly rare, the `CURLM_BAD_EASY_HANDLE` / `CURLM_BAD_HANDLE` should only be caused by internal Symfony bugs, and `CURLM_INTERNAL_ERROR` should only be caused by internal libcurl bugs, which leaves CURLM_OUT_OF_MEMORY Commits ------- 6f66dec437 [HttpClient] Don't ignore errors from curl_multi_exec()
2 parents fe9f3d6 + 60877af commit bbd1f60

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Response/CurlResponse.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,11 @@ private static function perform(ClientState $multi, array &$responses = null): v
274274
try {
275275
self::$performing = true;
276276
$active = 0;
277-
while (\CURLM_CALL_MULTI_PERFORM === curl_multi_exec($multi->handle, $active));
277+
while (\CURLM_CALL_MULTI_PERFORM === ($err = curl_multi_exec($multi->handle, $active)));
278+
279+
if (\CURLM_OK !== $err) {
280+
throw new TransportException(curl_multi_strerror($err));
281+
}
278282

279283
while ($info = curl_multi_info_read($multi->handle)) {
280284
if (\CURLMSG_DONE !== $info['msg']) {

0 commit comments

Comments
 (0)