Make WordPress Core

Changeset 30133


Ignore:
Timestamp:
11/01/2014 12:53:26 AM (9 years ago)
Author:
wonderboymusic
Message:

[28785] introduced a bug, where encoded query arguments were decoded by parse_str() inside of wp_parse_str() but never re-encoded later on.

This encodes them, adds unit test.

Props obenland.
Fixes #29636.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r30105 r30133  
    24762476    if ( isset( $url_parts[1] ) ) {
    24772477        wp_parse_str( $url_parts[1], $query_args );
     2478        $query_args = urlencode_deep( $query_args );
    24782479    }
    24792480
  • trunk/tests/phpunit/tests/general/paginateLinks.php

    r29913 r30133  
    189189
    190190    function add_query_arg( $url ) {
    191         return add_query_arg( array( 'foo' => 'bar' ), $url );
     191        return add_query_arg( array(
     192            'foo' => 'bar',
     193            's'   => 'search+term',
     194        ), $url );
    192195    }
    193196
     
    209212        $document->preserveWhiteSpace = false;
    210213
    211         // All links should have foo=bar arguments:
     214        // All links should have foo=bar arguments and be escaped:
    212215        $data = array(
    213             0 => home_url( '/?foo=bar' ),
    214             1 => home_url( '/?foo=bar' ),
    215             3 => home_url( '/?paged=3&foo=bar' ),
    216             5 => home_url( '/?paged=5&foo=bar' ),
    217             6 => home_url( '/?paged=3&foo=bar' ),
     216            0 => home_url( '/?foo=bar&s=search+term' ),
     217            1 => home_url( '/?foo=bar&s=search+term' ),
     218            3 => home_url( '/?paged=3&foo=bar&s=search+term' ),
     219            5 => home_url( '/?paged=5&foo=bar&s=search+term' ),
     220            6 => home_url( '/?paged=3&foo=bar&s=search+term' ),
    218221        );
    219222
Note: See TracChangeset for help on using the changeset viewer.