[wp-trac] [WordPress Trac] #23290: When using switch_to_blog() with a persistent object cache that lacks wp_cache_switch_to_blog() support, non-persistent groups are not maintained
WordPress Trac
noreply at wordpress.org
Sun Feb 22 16:12:48 UTC 2026
#23290: When using switch_to_blog() with a persistent object cache that lacks
wp_cache_switch_to_blog() support, non-persistent groups are not maintained
-------------------------------------------------+-------------------------
Reporter: markjaquith | Owner:
| johnjamesjacoby
Type: defect (bug) | Status: assigned
Priority: low | Milestone: 7.0
Component: Cache API | Version: 3.5
Severity: normal | Resolution:
Keywords: has-patch needs-testing 2nd-opinion | Focuses: multisite
-------------------------------------------------+-------------------------
Changes (by johnjamesjacoby):
* keywords: has-patch needs-testing => has-patch needs-testing 2nd-opinion
* version: 3.0 => 3.5
Comment:
23290-5.patch is a combo of 3.patch, 4.patch, and phpunit.patch:
* Adds `wp_cache_switch_to_blog_fallback()` to `ms-blogs.php` so it can be
independently unit tested
* Adds `wp_cache_switch_to_blog()` to `cache-compat.php.php` so it always
exists
* Adds `Tests_Multisite_WpCacheSwitchToBlogFallback` with around 25 new
tests that the fallback is working
* Moves `wp_cache_switch_to_blog()` to the `switch_blog` action
(Critical eyes may notice that `wp_cache_switch_to_blog_fallback()` does
not have a `$blog_id` parameter, even though one is passed into it inside
of
`Tests_Multisite_WpCacheSwitchToBlogFallback::call_cache_switch_fallback()`.
This is intentional, because: the function doesn't currently need the
parameter, if we add one later the tests are already covered, and PHP
doesn't complain about it.)
IMO, this is ready for 2nd opinion & commit. Maybe @jeremyfelt or
@spacedmonkey?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/23290#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list