Skip to content

Commit 064f75e

Browse files
committed
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 #7196 Follow-up to [58473]. Props jonsurrell. git-svn-id: https://develop.svn.wordpress.org/trunk@58897 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b90fe46 commit 064f75e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wp-includes/html-api/class-wp-html-tag-processor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3667,7 +3667,7 @@ public function set_attribute( $name, $value ): bool {
36673667
*
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.
36733673
if ( '' === $escaped_new_value && '' !== $value ) {

0 commit comments

Comments
 (0)