Make WordPress Core

Changeset 59945


Ignore:
Timestamp:
03/06/2025 02:59:34 PM (8 weeks ago)
Author:
audrasjb
Message:

Customize: Properly escape URLs passed by url and return parameters.

This changeset replaces sanitize_text_field() with esc_url_raw() for URLs passed via url and return query vars. This fixes an issue where the URL example.com/หน้าภาษาไทย would incorrectly return example.com// due to improper sanitization when clicking on the Customize button through the admin bar.

Props okvee, yahaly, hellofromTonya, veryard, dilip2615, amin7, swissspidy, audrasjb.
Fixes #61317.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/customize.php

    r59825 r59945  
    8585}
    8686
    87 $url       = ! empty( $_REQUEST['url'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['url'] ) ) : '';
    88 $return    = ! empty( $_REQUEST['return'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['return'] ) ) : '';
     87$url       = ! empty( $_REQUEST['url'] ) ? esc_url_raw( wp_unslash( $_REQUEST['url'] ) ) : '';
     88$return    = ! empty( $_REQUEST['return'] ) ? esc_url_raw( wp_unslash( $_REQUEST['return'] ) ) : '';
    8989$autofocus = ! empty( $_REQUEST['autofocus'] ) && is_array( $_REQUEST['autofocus'] )
    9090    ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['autofocus'] ) )
Note: See TracChangeset for help on using the changeset viewer.