Skip to content

Commit 30e4339

Browse files
authored
Merge pull request #122 from jtsternberg/fix-array-string-generation
Fix keys for deeply nested arrays being dropped.
2 parents fe7f452 + 5522b87 commit 30e4339

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/class-wp-rest-oauth1.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -729,14 +729,14 @@ public function create_signature_string( $params ) {
729729
*/
730730
public function join_with_equals_sign( $params, $query_params = array(), $key = '' ) {
731731
foreach ( $params as $param_key => $param_value ) {
732+
if ( $key ) {
733+
$param_key = $key . '%5B' . $param_key . '%5D'; // Handle multi-dimensional array
734+
}
732735
if ( is_array( $param_value ) ) {
733736
$query_params = $this->join_with_equals_sign( $param_value, $query_params, $param_key );
734737
} else {
735-
if ( $key ) {
736-
$param_key = $key . '%5B' . $param_key . '%5D'; // Handle multi-dimensional array
737-
}
738738
$string = $param_key . '=' . $param_value; // join with equals sign
739-
$query_params[] = self::urlencode_rfc3986($string );
739+
$query_params[] = self::urlencode_rfc3986( $string );
740740
}
741741
}
742742
return $query_params;

0 commit comments

Comments
 (0)