#18422 closed defect (bug) (fixed)
Oddities in add(_site)_option
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
[13139] made a number of changes to standardise the the values returned by the options API. However add_option() will still return null when the option already exists. This should be changed to return false
and the @return docs updated.
I then also spotted a difference in the behaviour of add_option() vs. add_site_option(). add_option() will just stop if the option already exists, see above, but add_site_option() will call update_site_option().
On singlesite installs add_site_option() is just a wrapper for add_option() so calling add_site_option() has different behaviour on multisite vs. singlesite.
Attachments (3)
Change History (17)
#2
@
14 years ago
- Milestone changed from Awaiting Review to 3.3
add_site_option() will call update_site_option().
That is terrible.
I'm good on 18422.diff.
#5
follow-up:
↓ 6
@
14 years ago
Patch attached for the 2nd part of the ticket. add_site_option() shouldn't update_site_option() if it already exists. Thoughts please, aye or nay?
#11
@
14 years ago
Likewise. A note in the phpdoc, codex, and wpdevel would be prudent, as would doing this now rather than later.
Would also be okay with 1 => true.
#12
@
14 years ago
That returns true instead of 1 and incorporates 18422.add-shouldnt-update.diff. With that patch the unit tests run clean against multisite.
return false in add_option