Tests: Add more test cases for WP_Object_Cache::is_valid_key().

A valid cache key for `wp_cache_*()` functions must be either an integer number or a non-empty string. To avoid potential compatibility issues or key collisions, a string that becomes empty after `trim()` should not be considered a valid cache key.

Follow-up to [53818], [53821], [53822].

Props tillkruess.
See #56198.

git-svn-id: https://develop.svn.wordpress.org/trunk@53834 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-08-04 17:31:45 +00:00
parent d1b3e1cfd4
commit 74c8b7f2de

View File

@ -61,7 +61,11 @@ class Tests_Cache extends WP_UnitTestCase {
return array(
array( false, false ),
array( null, false ),
array( "\n", false ),
array( "\0", false ),
array( '', false ),
array( ' ', false ),
array( ' ', false ),
array( 0.0, false ),
array( 0, true ),
array( 1, true ),