[wp-trac] [WordPress Trac] #52798: delete_option() does not clear cache if option is missing in database.
WordPress Trac
noreply at wordpress.org
Mon Apr 5 13:43:10 UTC 2021
#52798: delete_option() does not clear cache if option is missing in database.
-------------------------------------------------+-------------------------
Reporter: emrikol | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Options, Meta APIs | Version: trunk
Severity: minor | Resolution:
Keywords: 2nd-opinion has-patch has-unit- | Focuses:
tests |
-------------------------------------------------+-------------------------
Comment (by donmhico):
I attached a PR above that should fix the issue. In the PR I moved the
block of code which deletes the cache before it checks if the option
exists in the database. I think that since we are deleting the option in
DB, it's safe to delete it in the cache regardless of whether the option
exists in database or not. Also you can notice that if the option is not
present in the DB we are still returning `false` early, without triggering
the `delete_option` and other actions. It's because I believe that those
actions should only be triggered if the option is deleted in the
**database** and shouldn't be triggered if the option are only deleted in
the cache.
Any other thoughts / insights are welcome!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52798#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list