Docs: Fix typo in `_validate_cache_id()` description.
Includes: * Capitalizing "ID" in a consistent way. * Expanding the comment on not using `filter_var()`. * Adding a `@covers` tag for the function in unit tests. * Minor tweak to the `_doing_it_wrong()` message. Follow-up to [53818], [55543]. See #57593. Built from https://develop.svn.wordpress.org/trunk@55549 git-svn-id: http://core.svn.wordpress.org/trunk@55061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
00803d3e5f
commit
0c53d8ef73
|
@ -156,7 +156,7 @@ class WP_Object_Cache {
|
||||||
$message = is_string( $key )
|
$message = is_string( $key )
|
||||||
? __( 'Cache key must not be an empty string.' )
|
? __( 'Cache key must not be an empty string.' )
|
||||||
/* translators: %s: The type of the given cache key. */
|
/* translators: %s: The type of the given cache key. */
|
||||||
: sprintf( __( 'Cache key must be integer or non-empty string, %s given.' ), $type );
|
: sprintf( __( 'Cache key must be an integer or a non-empty string, %s given.' ), $type );
|
||||||
|
|
||||||
_doing_it_wrong(
|
_doing_it_wrong(
|
||||||
sprintf( '%s::%s', __CLASS__, debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 2 )[1]['function'] ),
|
sprintf( '%s::%s', __CLASS__, debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 2 )[1]['function'] ),
|
||||||
|
|
|
@ -7034,24 +7034,28 @@ function _get_non_cached_ids( $object_ids, $cache_key ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the given cache ID is either an integer or iterger-like strings.
|
* Checks whether the given cache ID is either an integer or an integer-like string.
|
||||||
* Both `16` and `"16"` are considered valid, other numeric types and numeric
|
*
|
||||||
* strings (`16.3` and `"16.3"`) are considered invalid.
|
* Both `16` and `"16"` are considered valid, other numeric types and numeric strings
|
||||||
|
* (`16.3` and `"16.3"`) are considered invalid.
|
||||||
*
|
*
|
||||||
* @since 6.3.0
|
* @since 6.3.0
|
||||||
*
|
*
|
||||||
* @param mixed $object_id The cache id to validate.
|
* @param mixed $object_id The cache ID to validate.
|
||||||
* @return bool Whether the given $object_id is a valid cache id.
|
* @return bool Whether the given $object_id is a valid cache ID.
|
||||||
*/
|
*/
|
||||||
function _validate_cache_id( $object_id ) {
|
function _validate_cache_id( $object_id ) {
|
||||||
// Unfortunately filter_var() is considered an optional extension
|
/*
|
||||||
|
* filter_var() could be used here, but the `filter` PHP extension
|
||||||
|
* is considered optional and may not be available.
|
||||||
|
*/
|
||||||
if ( is_int( $object_id )
|
if ( is_int( $object_id )
|
||||||
|| ( is_string( $object_id ) && (string) (int) $object_id === $object_id ) ) {
|
|| ( is_string( $object_id ) && (string) (int) $object_id === $object_id ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* translators: %s: The type of the given object id. */
|
/* translators: %s: The type of the given object ID. */
|
||||||
$message = sprintf( __( 'Object id must be integer, %s given.' ), gettype( $object_id ) );
|
$message = sprintf( __( 'Object ID must be an integer, %s given.' ), gettype( $object_id ) );
|
||||||
_doing_it_wrong( '_get_non_cached_ids', $message, '6.3.0' );
|
_doing_it_wrong( '_get_non_cached_ids', $message, '6.3.0' );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.3-alpha-55547';
|
$wp_version = '6.3-alpha-55549';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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