Make WordPress Core

Changeset 58897


Ignore:
Timestamp:
08/14/2024 07:49:03 PM (13 months ago)
Author:
dmsnell
Message:

HTML API: Use strict in_array comparison for checking URI attributes.

This patch modifies the URL-escaping code in the HTML API to rely on strict comparisons. This prevents accidental matching via type-coercion.

Developed in https://github.com/wordpress/wordpress-develop/pull/7196

Follow-up to [58473].
Props jonsurrell.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/html-api/class-wp-html-tag-processor.php

    r58893 r58897  
    36683668             * @see https://html.spec.whatwg.org/#attributes-3
    36693669             */
    3670             $escaped_new_value = in_array( $comparable_name, wp_kses_uri_attributes() ) ? esc_url( $value ) : esc_attr( $value );
     3670            $escaped_new_value = in_array( $comparable_name, wp_kses_uri_attributes(), true ) ? esc_url( $value ) : esc_attr( $value );
    36713671
    36723672            // If the escaping functions wiped out the update, reject it and indicate it was rejected.
Note: See TracChangeset for help on using the changeset viewer.