[wp-trac] [WordPress Trac] #56000: Validate cache key type in runtime cache to avoid errors when switching to permanent object caches
WordPress Trac
noreply at wordpress.org
Fri Jun 17 09:54:02 UTC 2022
#56000: Validate cache key type in runtime cache to avoid errors when switching to
permanent object caches
-------------------------+-----------------------------
Reporter: malthert | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cache API | Version: trunk
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
wp_cache_set (and therefore WP_Object_Cache->set) accepts int|string keys.
Unfortunately, tons of plugins pass NULL as key to cache due to bad
code/error handling on their end.
While this works with the runtime cache, most permanent object caches
either a) don't work with NULL keys or b) have unexpected behavior (e.g.
they convert null keys to something else, e.g. empty string) before
setting the key in the backend (thus causing key collisions)
Since most plugins are developed with permanent object cache off, I think
we should validate the key type to at least check it's not null.
Maybe even go a step further, and restrict keys to be int|non-empty-
string.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56000>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list