Skip to content

Commit

Permalink
Merge pull request WP-API#122 from jtsternberg/fix-array-string-gener…
Browse files Browse the repository at this point in the history
…ation

Fix keys for deeply nested arrays being dropped.
  • Loading branch information
rmccue authored Mar 9, 2017
2 parents fe7f452 + 5522b87 commit 30e4339
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/class-wp-rest-oauth1.php
Original file line number Diff line number Diff line change
Expand Up @@ -729,14 +729,14 @@ public function create_signature_string( $params ) {
*/
public function join_with_equals_sign( $params, $query_params = array(), $key = '' ) {
foreach ( $params as $param_key => $param_value ) {
if ( $key ) {
$param_key = $key . '%5B' . $param_key . '%5D'; // Handle multi-dimensional array
}
if ( is_array( $param_value ) ) {
$query_params = $this->join_with_equals_sign( $param_value, $query_params, $param_key );
} else {
if ( $key ) {
$param_key = $key . '%5B' . $param_key . '%5D'; // Handle multi-dimensional array
}
$string = $param_key . '=' . $param_value; // join with equals sign
$query_params[] = self::urlencode_rfc3986($string );
$query_params[] = self::urlencode_rfc3986( $string );
}
}
return $query_params;
Expand Down

0 comments on commit 30e4339

Please sign in to comment.