[wp-trac] [WordPress Trac] #38301: update_network_option not accepting null for network_id

WordPress Trac noreply at wordpress.org
Thu Oct 13 08:57:33 UTC 2016


#38301: update_network_option not accepting null for network_id
--------------------------+-----------------------------
 Reporter:  aliakro       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.6.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 As per the documentation
 (https://developer.wordpress.org/reference/functions/update_network_option/)
 it states:

 "(int) (Required) ID of the network. Can be null to default to the current
 network ID."

 However, specifying null returns false.

 Looking at the function, It could never get to point to determine the
 network id itself:

 {{{#!php
 function update_network_option( $network_id, $option, $value ) {
     global $wpdb, $current_site;

     if ( $network_id && ! is_numeric( $network_id ) ) {
         return false;
     }

     $network_id = (int) $network_id;

     // Fallback to the current network if a network ID is not specified.
     if ( ! $network_id && is_multisite() ) {
         $network_id = $current_site->id;
     }

 }}}

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


More information about the wp-trac mailing list