[wp-trac] [WordPress Trac] #61762: Options can be incorrectly cached following database errors.

WordPress Trac noreply at wordpress.org
Thu Jul 25 23:39:04 UTC 2024


#61762: Options can be incorrectly cached following database errors.
--------------------------------+-----------------------------
 Reporter:  peterwilsoncc       |      Owner:  (none)
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Options, Meta APIs  |    Version:
 Severity:  normal              |   Keywords:
  Focuses:                      |
--------------------------------+-----------------------------
 Various `wpdb` methods can return falsey values to indicate one of two
 things:

 * `0`: zero effected rows
 * `false`: a database error

 In `get_option()`, `get_network_option()`, `delete_option()` and
 `delete_network_option()` the results of the database query are
 imprecisely checked and can result in populated the `notoptions` cache
 incorrectly. Either by adding to the cache following a database error, or
 not adding to the cache when the zero rows are effected while deleting an
 option.

 In `add_network_option()`, `update_network_option()` the `notoptions`
 cache is cleared prior to the database query without accounting for
 database errors. (This simply causes additional queries rather than
 incorrect data being returned.)

 Related #61484, props @bjorsch for picking up.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61762>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list