[wp-trac] [WordPress Trac] #41099: update_option return value ambiguous

WordPress Trac noreply at wordpress.org
Thu Mar 28 16:23:55 UTC 2019


#41099: update_option return value ambiguous
--------------------------------+------------------------------
 Reporter:  cloughit            |       Owner:  (none)
     Type:  enhancement         |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Options, Meta APIs  |     Version:  4.8
 Severity:  normal              |  Resolution:
 Keywords:                      |     Focuses:
--------------------------------+------------------------------

Comment (by travisnorthcutt):

 It seems perfectly logical that `update_option()` should return an
 instance of `WP_Error` if updating failed. Changing existing behavior on
 the "no update" scenario (from `false` to `null`) seems somewhat non-
 backwards compatible... though anyone relying on `false` to indicate "no
 update" is already doing so unreliably, so ¯\_(ツ)_/¯.

 The case where this would fail is if anyone is checking the return value
 non-strictly, because `WP_Error` is truthy.

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


More information about the wp-trac mailing list