Make WordPress Core

Ticket #38331: patch-38331

File patch-38331, 1.0 KB (added by dgwatkins, 7 years ago)

re-encode keys and values

Line 
1Index: wp-includes/canonical.php
2===================================================================
3--- wp-includes/canonical.php   (revision 39483)
4+++ wp-includes/canonical.php   (working copy)
5@@ -368,7 +368,11 @@
6                                unset( $_parsed_query['name'] );
7                }
8 
9-               $_parsed_query = rawurlencode_deep( $_parsed_query );
10+               $_parsed_query = array_combine(
11+                       rawurlencode_deep( array_keys( $_parsed_query ) ),
12+                       rawurlencode_deep( $_parsed_query)
13+               );
14+
15                $redirect_url = add_query_arg( $_parsed_query, $redirect_url );
16        }
17 
18Index: wp-includes/functions.php
19===================================================================
20--- wp-includes/functions.php   (revision 39483)
21+++ wp-includes/functions.php   (working copy)
22@@ -809,7 +809,12 @@
23        }
24 
25        wp_parse_str( $query, $qs );
26-       $qs = urlencode_deep( $qs ); // this re-URL-encodes things that were already in the query string
27+
28+       $qs = array_combine(
29+               urlencode_deep( array_keys( $qs ) ),
30+               urlencode_deep( $qs )
31+       );
32+
33        if ( is_array( $args[0] ) ) {
34                foreach ( $args[0] as $k => $v ) {
35                        $qs[ $k ] = $v;