[wp-trac] [WordPress Trac] #40007: update_option function does not work if the $value argument is false on a nonexistent option

WordPress Trac noreply at wordpress.org
Wed Mar 1 17:04:01 UTC 2017


#40007: update_option function does not work if the $value argument is false on a
nonexistent option
--------------------------+-----------------------------
 Reporter:  alexvorn2     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 If we specify a false argument in update_option function and if the
 database option does not exist then the option will not be saved.

 I expect the option to be saved with false value if it does not exist.

 If we look into the code of this function we can see that it will return
 false if the old value is false too, so if the option does not exists then
 it will return false.

 It's a bug.

 How to replicate? give a try:

 {{{#!php
 <?php
 update_option( 'aaa2345454', false );
 }}}

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


More information about the wp-trac mailing list