[wp-trac] [WordPress Trac] #21989: update_option() calls sanitize_option() twice when option does not exist

WordPress Trac noreply at wordpress.org
Thu Apr 4 19:01:09 UTC 2024


#21989: update_option() calls sanitize_option() twice when option does not exist
-------------------------------------------------+-------------------------
 Reporter:  MikeSchinkel                         |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Options, Meta APIs                   |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  dev-feedback has-patch needs-        |     Focuses:
  testing                                        |  performance
-------------------------------------------------+-------------------------

Comment (by pbearne):

 Trying to make sense of this ticket

 We need to call sanitize_option before the filters
 pre_update_option_{$option} and pre_update_option so that they can adjust
 the value
 as there are not match filters in add_option()
 Which feels like there should be

 So one option could be
 If the option not found call add_option() with the raw value early and add
 the filters to that function

 Throughts?

 Paul

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


More information about the wp-trac mailing list