[wp-trac] [WordPress Trac] #31047: Option nonexistence should not be checked against false

WordPress Trac noreply at wordpress.org
Mon Jan 19 19:53:24 UTC 2015


#31047: Option nonexistence should not be checked against false
-------------------------------------+------------------
 Reporter:  GregLone                 |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  4.2
Component:  Options, Meta APIs       |     Version:  3.4
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+------------------

Comment (by Denis-de-Bernardy):

 Replying to [comment:5 nacin]:
 > Is #22192 a duplicate?

 It doesn't seem so. As I understand the two tickets, the one you
 highlighted is related to a cache issue, whereas this one is related to
 comparing apples (false) to oranges (the actual default) when checking for
 a default value.

 My gut reaction when I initially read the ticket was to wonder whether it
 was valid at all: it's convenient in some sense to standardize around
 false, as it currently means the option doesn't exist, because it's not
 currently possible or practical to store `false` as a value using the
 options API. If I understand the proposed patch correctly, we're going to
 potentially add a DB query for any `get_option()` call with a non-existent
 value that has the function's default value parameter set. So that point
 is worth checking for. I'm not entirely sure of the other potential side-
 effects of the patch off the top of my head.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31047#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list