[wp-trac] [WordPress Trac] #35379: update_network_option changes stored option value if sanitize_option detects error
WordPress Trac
noreply at wordpress.org
Tue Apr 26 16:38:17 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):
@codex-m The patch looks great I think. One thing that could be simplified
in my opinion are lines 3654-3668 (initial check for `$context_id` in
network mode). It's probably not needed to add a new variable
`$network_id` there, we should be able to use the original `$context_id`
throughout the entire function. Maybe something like this:
{{{#!php
<?php
if ( 'network' === $context ) {
if ( ! is_multisite() ) {
$context = 'site'; // or we could throw a _doing_it_wrong() here
} elseif ( ! $context_id ) {
global $current_site;
$context_id = $current_site->id;
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35379#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list