[wp-trac] [WordPress Trac] #64950: wp_using_ext_object_cache can return null, causing type failures, potential fatals
WordPress Trac
noreply at wordpress.org
Wed Mar 25 20:41:38 UTC 2026
#64950: wp_using_ext_object_cache can return null, causing type failures, potential
fatals
--------------------------+-----------------------------
Reporter: ronalfy | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cache API | Version: 3.7
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Function `wp_using_ext_object_cache` has a `bool` return signature, but it
can also return null in certain cases.
If `global $_wp_using_ext_object_cache;` is not set, then it it assumed
null.
Line `$current_using = $_wp_using_ext_object_cache;` assigns it to return
variable.
Line `return $current_using;` then returns null.
If this function is ran before the global is set, the user must account
for null cases instead of a simple bool check. I recommend changing the
signature to account for null, or do a null check in the function itself
and return a falsey value.
https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-
includes/load.php#L810
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64950>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list