From a8cfb856c44d9eb6ac43be8c9bb975897bb8b4e8 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Sat, 24 May 2008 21:54:57 +0000 Subject: [PATCH] Add array support to wfArrayToCGI(): when receiving parameters in the form of &foo[]=bar&foo[]=baz, PHP automatically sets $_GET['foo'] = array(bar, baz); When feeding the original query back to wfArrayToCGI(), it used to choke on that. Now wfArrayToCGI() actually converts array('bar', 'baz'); back to the &foo[]=bar&foo[]=baz form. --- includes/GlobalFunctions.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index a9bf015df4..3294c8f9b0 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -999,7 +999,13 @@ function wfArrayToCGI( $array1, $array2 = NULL ) if ( '' != $cgi ) { $cgi .= '&'; } - $cgi .= urlencode( $key ) . '=' . urlencode( $value ); + if(is_array($value)) + foreach($value as $v) + $cgi .= urlencode( $key . '[]' ) . '=' . + urlencode( $v ); + else + $cgi .= urlencode( $key ) . '=' . + urlencode( $value ); } } return $cgi; -- 2.20.1