From: Chad Horohoe Date: Fri, 27 Feb 2015 16:48:21 +0000 (-0800) Subject: Remove $timeout parameter from Http::get() X-Git-Tag: 1.31.0-rc.0~12234^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=a718795dea4acf6b6425c2610e2c8d45efe4d1f3 Remove $timeout parameter from Http::get() It is inconsistent with request() and post() and there's a couple of mistaken usages in core and extensions that think they have the same signature. Change-Id: I834278639a3648edec7bcb57db7bb61f456d2a92 --- diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index d066df89e6..7f0d6a2160 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -82,14 +82,22 @@ class Http { /** * Simple wrapper for Http::request( 'GET' ) * @see Http::request() + * @since 1.25 Second parameter $timeout removed. Second parameter + * is now $options which can be given a 'timeout' * * @param string $url - * @param string $timeout * @param array $options * @return string */ - public static function get( $url, $timeout = 'default', $options = array() ) { - $options['timeout'] = $timeout; + public static function get( $url, $options = array() ) { + $args = func_get_args(); + if ( is_string( $args[1] ) || is_numeric( $args[1] ) ) { + // Second was used to be the timeout + // And third parameter used to be $options + wfWarn( "Second parameter should not be a timeout." ); + $options = isset( $args[2] ) ? $args[2] : array(); + $options['timeout'] = $args[1]; + } return Http::request( 'GET', $url, $options ); }