From da148b501044824b930db83234718a1341f072a1 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Wed, 15 Apr 2020 12:34:51 -0700 Subject: [PATCH 1/1] MultiHttpClient: Also fallover to non-curl if curl_multi* is blocked Requested by a user at https://www.mediawiki.org/wiki/Topic:Vkk1ahk3eggd9747 for whom their hoster provides curl but with multi-threaded functions removed for some reason. Change-Id: Id3877c600ae02feffb67f74a815430f8e679230a (cherry picked from commit 1c241419914d1203ea90eeea6a41d76f4a2ecbec) --- RELEASE-NOTES-1.34 | 1 + includes/libs/http/MultiHttpClient.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES-1.34 b/RELEASE-NOTES-1.34 index 3b5def59cc..d035653201 100644 --- a/RELEASE-NOTES-1.34 +++ b/RELEASE-NOTES-1.34 @@ -5,6 +5,7 @@ THIS IS NOT A RELEASE YET === Changes since MediaWiki 1.34.1 === +* The MultiHttpClient code will fallover to non-curl if curl_multi* is blocked. == MediaWiki 1.34.1 == diff --git a/includes/libs/http/MultiHttpClient.php b/includes/libs/http/MultiHttpClient.php index b0c8a8b438..85959d6883 100644 --- a/includes/libs/http/MultiHttpClient.php +++ b/includes/libs/http/MultiHttpClient.php @@ -176,7 +176,9 @@ class MultiHttpClient implements LoggerAwareInterface { * @return bool true if curl is available, false otherwise. */ protected function isCurlEnabled() { - return extension_loaded( 'curl' ); + // Explicitly test if curl_multi* is blocked, as some users' hosts provide + // them with a modified curl with the multi-threaded parts removed(!) + return extension_loaded( 'curl' ) && function_exists( 'curl_multi_init' ); } /** -- 2.20.1