[wp-trac] [WordPress Trac] #59738: `wp_load_options()` makes DB queries for known non-existent options (notoptions).
WordPress Trac
noreply at wordpress.org
Fri Oct 27 00:56:57 UTC 2023
#59738: `wp_load_options()` makes DB queries for known non-existent options
(notoptions).
--------------------------------------+--------------------------
Reporter: peterwilsoncc | Owner: flixos90
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 6.4
Component: Options, Meta APIs | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: performance
--------------------------------------+--------------------------
Comment (by peterwilsoncc):
@flixos90 and I picked up a few things while looking over this, in
addition to the items above:
* primed falsey option values `''`, `'0'` and `array()` result in a second
query as the option's cache value wasn't using a strict type check
* a few tests for incorrect items in `notoptions` used the `notoptions`
group rather than cache key in the `options` group.
* the tests confirming that `wp_prime_option_caches_by_group()` was
correctly priming the cache used the expected value `get_option(
'option_name' )` which will prime the cache, potentially causing a false
pass
The [https://github.com/WordPress/wordpress-develop/pull/5576 linked pull
request] fixes each of the above along with the original issue. It's now
ready for review.
@hellofromTonya and @mikeschroder:
As the option value `'0'` is quite common (there are 17 in a clean WP
install) I think it's probably worth trying to get this in to 6.4.0 but
I'll let you make the call as tech leads.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59738#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list