[wp-trac] [WordPress Trac] #35379: update_network_option changes stored option value if sanitize_option detects error

WordPress Trac noreply at wordpress.org
Thu Apr 14 08:18:46 UTC 2016


#35379: update_network_option changes stored option value if sanitize_option
detects error
-------------------------------------------------+-------------------------
 Reporter:  thomaswm                             |       Owner:  jeremyfelt
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  Future
Component:  Options, Meta APIs                   |  Release
 Severity:  normal                               |     Version:  3.0
 Keywords:  has-patch has-unit-tests dev-        |  Resolution:
  feedback needs-testing                         |     Focuses:  multisite
-------------------------------------------------+-------------------------

Comment (by flixos90):

 When merging #35698 into this ticket, we should probably have
 `sanitize_option()` use the `$network_id` as third parameter (as it
 provides more value and is needed for this ticket) and then automatically
 detect the `$context` variable inside the function like

 `$context = $network_id ? 'network' : 'site';`

 Alternatively we could add both as a parameter, `$context` as third
 parameter and then `$network_id` as fourth. We might even name it
 `$context_id` then as this would provide flexibility for possible other
 contexts in the future, also for the regular option context.

 Examples: A function like `get_option()` could then call it as

 `sanitize_option( $option, $value, 'site', get_current_blog_id() )`

 while `get_network_option()` would call it as

 `sanitize_option( $option, $value, 'network', $network_id )`

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


More information about the wp-trac mailing list