mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-07 14:14:36 +00:00
General: Ensure consistent type for integer properties of WP_Post, WP_Term, and WP_User.
Previously, these properties could be unexpectedly converted to strings in some contexts. This applies to the following functions: * `sanitize_post_field()` * `sanitize_term_field()` * `sanitize_user_field()` and the following properties: * `WP_Post::ID` * `WP_Post::post_parent` * `WP_Post::menu_order` * `WP_Term::term_id` * `WP_Term::term_taxonomy_id` * `WP_Term::parent` * `WP_Term::count` * `WP_Term::term_group` * `WP_User::ID` Props grantmkin, SergeyBiryukov. Fixes #53235. See #52995. git-svn-id: https://develop.svn.wordpress.org/trunk@50935 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1530,6 +1530,12 @@ function sanitize_user_field( $field, $value, $user_id, $context ) {
|
||||
} elseif ( 'js' === $context ) {
|
||||
$value = esc_js( $value );
|
||||
}
|
||||
|
||||
// Restore the type for integer fields after esc_attr().
|
||||
if ( in_array( $field, $int_fields, true ) ) {
|
||||
$value = (int) $value;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user