From: Roan Kattouw Date: Sun, 12 Apr 2009 17:38:41 +0000 (+0000) Subject: Fix warning in PHP 5.1 when feeding Title objects to wfArrayToCGI(). Also enforce... X-Git-Tag: 1.31.0-rc.0~42160 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=fe68c7d84ec96921e3171f6d37d6f0d3183c4133;p=lhc%2Fweb%2Fwiklou.git Fix warning in PHP 5.1 when feeding Title objects to wfArrayToCGI(). Also enforce consistent style --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 2ca81c9c5f..d69c2891fc 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1230,18 +1230,18 @@ function wfArrayToCGI( $array1, $array2 = NULL ) if ( '' != $cgi ) { $cgi .= '&'; } - if(is_array($value)) - { + if ( is_array( $value ) ) { $firstTime = true; - foreach($value as $v) - { - $cgi .= ($firstTime ? '' : '&') . + foreach ( $value as $v ) { + $cgi .= ( $firstTime ? '' : '&') . urlencode( $key . '[]' ) . '=' . urlencode( $v ); $firstTime = false; } - } - else + } else { + if ( is_object( $value ) ) { + $value = $value->__toString(); + } $cgi .= urlencode( $key ) . '=' . urlencode( $value ); }