diff --git a/wp-includes/bookmark.php b/wp-includes/bookmark.php index 674269e23b..f46ae93b54 100644 --- a/wp-includes/bookmark.php +++ b/wp-includes/bookmark.php @@ -391,16 +391,17 @@ function sanitize_bookmark( $bookmark, $context = 'display' ) { * @param string $field The bookmark field. * @param mixed $value The bookmark field value. * @param int $bookmark_id Bookmark ID. - * @param string $context How to filter the field value. Accepts 'raw', 'edit', 'attribute', - * 'js', 'db', or 'display' + * @param string $context How to filter the field value. Accepts 'raw', 'edit', 'db', + * 'display', 'attribute', or 'js'. Default 'display'. * @return mixed The filtered value. */ function sanitize_bookmark_field( $field, $value, $bookmark_id, $context ) { + $int_fields = array( 'link_id', 'link_rating' ); + if ( in_array( $field, $int_fields, true ) ) { + $value = (int) $value; + } + switch ( $field ) { - case 'link_id': // ints - case 'link_rating': - $value = (int) $value; - break; case 'link_category': // array( ints ) $value = array_map( 'absint', (array) $value ); // We return here so that the categories aren't filtered. @@ -445,6 +446,11 @@ function sanitize_bookmark_field( $field, $value, $bookmark_id, $context ) { } } + // Restore the type for integer fields after esc_attr(). + if ( in_array( $field, $int_fields, true ) ) { + $value = (int) $value; + } + return $value; } diff --git a/wp-includes/version.php b/wp-includes/version.php index ca445e437f..ecffeac010 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.8-alpha-50935'; +$wp_version = '5.8-alpha-50936'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.