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

WordPress Trac noreply at wordpress.org
Mon Jun 6 15:32:02 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:  4.6
Component:  Options, Meta APIs                   |     Version:  3.0
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:  multisite
  testing                                        |
-------------------------------------------------+-------------------------

Comment (by codex-m):

 @jeremyfelt Here is my patch illustrating the use
 `sanitize_network_option`. It's now possible to sanitize network-specific
 options by putting them on their own function.

 Since several of the WordPress default core options are used to both
 single-site and multisite-mode. I placed them in a new validating function
 called `wp_validate_default_options` which is called by both
 `sanitize_option' and `sanitize_network_option`. I implemented similar
 filters for consistency between single-site mode and multisite usage.

 I tested this using 35379_unit_test.2.diff test to cover this issue as
 well as standard WordPress unit tests. Works fine. Let me know what you
 think ;) Cheers.

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


More information about the wp-trac mailing list