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

WordPress Trac noreply at wordpress.org
Fri Jan 8 23:48:51 UTC 2016


#35379: update_network_option changes stored option value if sanitize_option
detects error
--------------------------------+-----------------------------
 Reporter:  thomaswm            |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Options, Meta APIs  |    Version:  4.4
 Severity:  normal              |   Keywords:
  Focuses:  multisite           |
--------------------------------+-----------------------------
 If you make a call like
 {{{
 update_network_option( null, "admin_email", "this.is.not.an.email.address"
 );
 }}}
 then the value of the `admin_email` ''network'' option will be changed to
 the value of the `admin_email` ''site'' option in the database. Expected
 behaviour would be that the option value in the database is not changed.

 The reason is that `update_network_option` calls
 {{{
 sanitize_option( "admin_email", "this.is.not.an.email.address" );
 }}}
 and writes its return value to the database. However, `sanitize_option`
 will return the value of `get_option( "admin_email" )`, instead of
 `get_network_option( null, "admin_email" )`. See
 [https://core.trac.wordpress.org/browser/tags/4.4/src/wp-
 includes/formatting.php#L3863 lines 3863ff. in formatting.php].

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


More information about the wp-trac mailing list