From: Aaron Schulz Date: Wed, 5 Aug 2015 23:49:12 +0000 (-0700) Subject: Fixed occasional MultiHttpClient "undefined index" errors X-Git-Tag: 1.31.0-rc.0~10492 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=795c8958840771e3a8603c417af3f0c464cf3cbd;p=lhc%2Fweb%2Fwiklou.git Fixed occasional MultiHttpClient "undefined index" errors * These show sometimes in Swift FileBackend tests Change-Id: I38c1817812282c94cab2011da7c322e92eec96ca --- diff --git a/includes/libs/MultiHttpClient.php b/includes/libs/MultiHttpClient.php index 2e7ef88361..6af3ed5168 100644 --- a/includes/libs/MultiHttpClient.php +++ b/includes/libs/MultiHttpClient.php @@ -72,7 +72,9 @@ class MultiHttpClient { throw new Exception( "Cannot find CA bundle: " . $this->caBundlePath ); } } - static $opts = array( 'connTimeout', 'reqTimeout', 'usePipelining', 'maxConnsPerHost', 'proxy' ); + static $opts = array( + 'connTimeout', 'reqTimeout', 'usePipelining', 'maxConnsPerHost', 'proxy' + ); foreach ( $opts as $key ) { if ( isset( $options[$key] ) ) { $this->$key = $options[$key]; @@ -222,15 +224,17 @@ class MultiHttpClient { $ch = $handles[$index]; curl_multi_remove_handle( $chm, $ch ); - $info = $infos[(int)$ch]; - - $errno = $info['result']; - if ( $errno !== 0 ) { - $req['response']['error'] = "(curl error: $errno)"; - - if ( function_exists( 'curl_strerror' ) ) { - $req['response']['error'] .= " " . curl_strerror( $errno ); + if ( isset( $infos[(int)$ch] ) ) { + $info = $infos[(int)$ch]; + $errno = $info['result']; + if ( $errno !== 0 ) { + $req['response']['error'] = "(curl error: $errno)"; + if ( function_exists( 'curl_strerror' ) ) { + $req['response']['error'] .= " " . curl_strerror( $errno ); + } } + } else { + $req['response']['error'] = "(curl error: no status set)"; } // For convenience with the list() operator