Changeset 55549
- Timestamp:
- 03/14/2023 04:53:07 PM (19 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-object-cache.php
r54318 r55549 157 157 ? __( 'Cache key must not be an empty string.' ) 158 158 /* translators: %s: The type of the given cache key. */ 159 : sprintf( __( 'Cache key must be integer ornon-empty string, %s given.' ), $type );159 : sprintf( __( 'Cache key must be an integer or a non-empty string, %s given.' ), $type ); 160 160 161 161 _doing_it_wrong( -
trunk/src/wp-includes/functions.php
r55543 r55549 7035 7035 7036 7036 /** 7037 * Checks whether the given cache ID is either an integer or iterger-like strings. 7038 * Both `16` and `"16"` are considered valid, other numeric types and numeric 7039 * strings (`16.3` and `"16.3"`) are considered invalid. 7037 * Checks whether the given cache ID is either an integer or an integer-like string. 7038 * 7039 * Both `16` and `"16"` are considered valid, other numeric types and numeric strings 7040 * (`16.3` and `"16.3"`) are considered invalid. 7040 7041 * 7041 7042 * @since 6.3.0 7042 7043 * 7043 * @param mixed $object_id The cache idto validate.7044 * @return bool Whether the given $object_id is a valid cache id.7044 * @param mixed $object_id The cache ID to validate. 7045 * @return bool Whether the given $object_id is a valid cache ID. 7045 7046 */ 7046 7047 function _validate_cache_id( $object_id ) { 7047 // Unfortunately filter_var() is considered an optional extension 7048 /* 7049 * filter_var() could be used here, but the `filter` PHP extension 7050 * is considered optional and may not be available. 7051 */ 7048 7052 if ( is_int( $object_id ) 7049 7053 || ( is_string( $object_id ) && (string) (int) $object_id === $object_id ) ) { … … 7051 7055 } 7052 7056 7053 /* translators: %s: The type of the given object id. */7054 $message = sprintf( __( 'Object id must beinteger, %s given.' ), gettype( $object_id ) );7057 /* translators: %s: The type of the given object ID. */ 7058 $message = sprintf( __( 'Object ID must be an integer, %s given.' ), gettype( $object_id ) ); 7055 7059 _doing_it_wrong( '_get_non_cached_ids', $message, '6.3.0' ); 7056 7060 -
trunk/tests/phpunit/tests/functions/getNonCachedIds.php
r55543 r55549 8 8 * 9 9 * @covers ::_get_non_cached_ids 10 * @covers ::_validate_cache_id 10 11 */ 11 12 class Tests_Functions_GetNonCachedIds extends WP_UnitTestCase { … … 29 30 * @dataProvider data_valid_ids_should_be_returned_as_integers 30 31 * 31 * @param mixed $object_id The object id.32 * @param mixed $object_id The object ID. 32 33 */ 33 34 public function test_valid_ids_should_be_returned_as_integers( $object_id ) { … … 70 71 * @dataProvider data_invalid_cache_ids_should_throw_a_notice 71 72 * 72 * @param mixed $object_id The object id.73 * @param mixed $object_id The object ID. 73 74 */ 74 75 public function test_invalid_cache_ids_should_throw_a_notice( $object_id ) {
Note: See TracChangeset
for help on using the changeset viewer.