[wp-trac] [WordPress Trac] #64950: wp_using_ext_object_cache can return null, causing type failures, potential fatals

WordPress Trac noreply at wordpress.org
Fri Apr 3 13:54:28 UTC 2026


#64950: wp_using_ext_object_cache can return null, causing type failures, potential
fatals
--------------------------+--------------------------
 Reporter:  ronalfy       |       Owner:  westonruter
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  7.1
Component:  Cache API     |     Version:  3.7
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+--------------------------

Comment (by ronalfy):

 @westonruter I'm not using a standard WP docker setup, but I can confirm
 our code is running in an activated plugin's constructor. As you
 mentioned, the result is `null`, which is the confusing part of this.

 If the function has returned `bool|null` all along, intentionally or not,
 then for backwards compatibility, I recommend updating the diff to remove
 the casting (essentially leave the function as-is) and update the return
 type to bool|null so a user consuming it can expect both types. We'll also
 want to update the docs because expecting a boolean and then checking that
 var will trigger a fatal.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64950#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list