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. Built from https://develop.svn.wordpress.org/trunk@50935 git-svn-id: http://core.svn.wordpress.org/trunk@50544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4a20a75fa1
commit
893beee31e
|
@ -2633,6 +2633,11 @@ function sanitize_post_field( $field, $value, $post_id, $context = 'display' ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restore the type for integer fields after esc_attr().
|
||||||
|
if ( in_array( $field, $int_fields, true ) ) {
|
||||||
|
$value = (int) $value;
|
||||||
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1760,6 +1760,12 @@ function sanitize_term_field( $field, $value, $term_id, $taxonomy, $context ) {
|
||||||
} elseif ( 'js' === $context ) {
|
} elseif ( 'js' === $context ) {
|
||||||
$value = esc_js( $value );
|
$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;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1530,6 +1530,12 @@ function sanitize_user_field( $field, $value, $user_id, $context ) {
|
||||||
} elseif ( 'js' === $context ) {
|
} elseif ( 'js' === $context ) {
|
||||||
$value = esc_js( $value );
|
$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;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.8-alpha-50934';
|
$wp_version = '5.8-alpha-50935';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
|
Loading…
Reference in New Issue