Skip to content

Commit 3e81c1a

Browse files
committed
Fix keys for deeply nested arrays being dropped.
Without this change, once an array gets past 2 levels deep, the top-level array keys get dropped. This change preserves the array keys all the way up.
1 parent bd6d869 commit 3e81c1a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/class-wp-rest-oauth1.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -725,12 +725,12 @@ public function create_signature_string( $params ) {
725725
*/
726726
public function join_with_equals_sign( $params, $query_params = array(), $key = '' ) {
727727
foreach ( $params as $param_key => $param_value ) {
728+
if ( $key ) {
729+
$param_key = $key . '[' . $param_key . ']'; // Handle multi-dimensional array
730+
}
728731
if ( is_array( $param_value ) ) {
729732
$query_params = $this->join_with_equals_sign( $param_value, $query_params, $param_key );
730733
} else {
731-
if ( $key ) {
732-
$param_key = $key . '[' . $param_key . ']'; // Handle multi-dimensional array
733-
}
734734
$string = $param_key . '=' . $param_value; // join with equals sign
735735
$query_params[] = urlencode( $string );
736736
}

0 commit comments

Comments
 (0)