Skip to content

Commit 03f3ea9

Browse files
committed
[BUGFIX] fixed format_query() allows multi-dimensional parameter arrays
1 parent fa38a9b commit 03f3ea9

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

restclient.php

+2-9
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,8 @@ public function execute($url, $method='GET', $parameters=[], $headers=[]){
201201
return $client;
202202
}
203203

204-
public function format_query($parameters, $primary='=', $secondary='&'){
205-
$query = "";
206-
foreach($parameters as $key => $values){
207-
foreach(is_array($values)? $values : [$values] as $value){
208-
$pair = [urlencode($key), urlencode($value)];
209-
$query .= implode($primary, $pair) . $secondary;
210-
}
211-
}
212-
return rtrim($query, $secondary);
204+
public function format_query($parameters){
205+
return http_build_query($parameters);
213206
}
214207

215208
public function parse_response($response){

0 commit comments

Comments
 (0)