[wp-trac] [WordPress Trac] #25015: 'alloptions' cache updated by update_option() and add_option() even on failure
WordPress Trac
noreply at wordpress.org
Mon Aug 12 18:19:22 UTC 2013
#25015: 'alloptions' cache updated by update_option() and add_option() even on
failure
--------------------------+-----------------------------
Reporter: jdgrimes | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cache | Version: 2.2
Severity: normal | Keywords:
--------------------------+-----------------------------
The `add_option()` and `update_option()` functions both update the
`'alloptions'` cache ''before'' performing the insert/update query on the
database. It is therefore possible to do the following:
{{{
add_option( 'test_option', 'foo' ); // Lets say this fails.
$option = get_option( 'test_option' ); // $option == 'foo' !
}}}
But now if we attempt to delete or update the option, we can't:
{{{
var_dump( delete_option( 'test_option' ) ); // bool(false)
var_dump( update_option( 'test_option', 'bar' ) ); // bool(false)
}}}
This was introduced in [4855].
--
Ticket URL: <http://core.trac.wordpress.org/ticket/25015>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list