Make WordPress Core

Ticket #46199: 46199.patch

File 46199.patch, 5.0 KB (added by dmsnell, 6 years ago)

initial proposal to fix #46199

  • wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
    index f673450d41..8fafc20e80 100644
    a b class WP_REST_Comments_Controller extends WP_REST_Controller { 
    285285                $response->header( 'X-WP-Total', $total_comments );
    286286                $response->header( 'X-WP-TotalPages', $max_pages );
    287287
    288                 $base = add_query_arg( $request->get_query_params(), rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ) );
     288                $base = add_query_arg( urlencode_deep( $request->get_query_params() ), rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ) );
    289289
    290290                if ( $request['page'] > 1 ) {
    291291                        $prev_page = $request['page'] - 1;
  • wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    index bc0a179f7f..0fb836d249 100644
    a b class WP_REST_Posts_Controller extends WP_REST_Controller { 
    343343                $response->header( 'X-WP-TotalPages', (int) $max_pages );
    344344
    345345                $request_params = $request->get_query_params();
    346                 $base           = add_query_arg( $request_params, rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ) );
     346                $base           = add_query_arg( urlencode_deep( $request_params ), rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ) );
    347347
    348348                if ( $page > 1 ) {
    349349                        $prev_page = $page - 1;
  • wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php

    diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
    index 5bdbb73df0..52df0f2206 100644
    a b class WP_REST_Revisions_Controller extends WP_REST_Controller { 
    301301                $response->header( 'X-WP-TotalPages', (int) $max_pages );
    302302
    303303                $request_params = $request->get_query_params();
    304                 $base           = add_query_arg( $request_params, rest_url( sprintf( '%s/%s/%d/%s', $this->namespace, $this->parent_base, $request['parent'], $this->rest_base ) ) );
     304                $base           = add_query_arg( urlencode_deep( $request_params ), rest_url( sprintf( '%s/%s/%d/%s', $this->namespace, $this->parent_base, $request['parent'], $this->rest_base ) ) );
    305305
    306306                if ( $page > 1 ) {
    307307                        $prev_page = $page - 1;
  • wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php

    diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php
    index 8aaf9c6476..299029b1c3 100644
    a b class WP_REST_Search_Controller extends WP_REST_Controller { 
    155155                $response->header( 'X-WP-TotalPages', $max_pages );
    156156
    157157                $request_params = $request->get_query_params();
    158                 $base           = add_query_arg( $request_params, rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ) );
     158                $base           = add_query_arg( urlencode_deep( $request_params ), rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ) );
    159159
    160160                if ( $page > 1 ) {
    161161                        $prev_link = add_query_arg( 'page', $page - 1, $base );
  • wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php

    diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
    index ff399cc60e..fafb74c083 100644
    a b class WP_REST_Terms_Controller extends WP_REST_Controller { 
    282282
    283283                $response->header( 'X-WP-TotalPages', (int) $max_pages );
    284284
    285                 $base = add_query_arg( $request->get_query_params(), rest_url( $this->namespace . '/' . $this->rest_base ) );
     285                $base = add_query_arg( urlencode_deep( $request->get_query_params() ), rest_url( $this->namespace . '/' . $this->rest_base ) );
    286286                if ( $page > 1 ) {
    287287                        $prev_page = $page - 1;
    288288
  • wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
    index 207198e54c..8aab4ca5ad 100644
    a b class WP_REST_Users_Controller extends WP_REST_Controller { 
    329329
    330330                $response->header( 'X-WP-TotalPages', (int) $max_pages );
    331331
    332                 $base = add_query_arg( $request->get_query_params(), rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ) );
     332                $base = add_query_arg( urlencode_deep( $request->get_query_params() ), rest_url( sprintf( '%s/%s', $this->namespace, $this->rest_base ) ) );
    333333                if ( $page > 1 ) {
    334334                        $prev_page = $page - 1;
    335335