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.

Built from https://develop.svn.wordpress.org/trunk@58897


git-svn-id: http://core.svn.wordpress.org/trunk@58293 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dmsnell 2024-08-14 19:51:17 +00:00
parent 713e76f16b
commit edd34df6ea
2 changed files with 2 additions and 2 deletions

View File

@ -3667,7 +3667,7 @@ class WP_HTML_Tag_Processor {
* *
* @see https://html.spec.whatwg.org/#attributes-3 * @see https://html.spec.whatwg.org/#attributes-3
*/ */
$escaped_new_value = in_array( $comparable_name, wp_kses_uri_attributes() ) ? esc_url( $value ) : esc_attr( $value ); $escaped_new_value = in_array( $comparable_name, wp_kses_uri_attributes(), true ) ? esc_url( $value ) : esc_attr( $value );
// If the escaping functions wiped out the update, reject it and indicate it was rejected. // If the escaping functions wiped out the update, reject it and indicate it was rejected.
if ( '' === $escaped_new_value && '' !== $value ) { if ( '' === $escaped_new_value && '' !== $value ) {

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.7-alpha-58896'; $wp_version = '6.7-alpha-58897';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.