[wp-trac] [WordPress Trac] #58042: Fix non-strictly checking issue on line 1014 of schema.php

WordPress Trac noreply at wordpress.org
Sat Apr 1 15:17:11 UTC 2023


#58042: Fix non-strictly checking issue on line 1014 of schema.php
------------------------------+-----------------------------
 Reporter:  faisalahammad     |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  General           |    Version:  trunk
 Severity:  normal            |   Keywords:  needs-patch
  Focuses:  coding-standards  |
------------------------------+-----------------------------
 I found a non-strictly checking issue on line **1014** from the **/wp-
 admin/includes/schema.php** file in WordPress. To fix this issue, we need
 to replace the == operator with the === operator, which ensures that the
 values being compared are of the same type. This will help to prevent
 potential bugs and improve the overall security of the code. Thank you!

 **Source code:**
 {{{#!php
 <?php
 if ( 1 == $network_id ) {
         $wpdb->insert(
                 $wpdb->site,
                 array(
                         'domain' => $domain,
                         'path'   => $path,
                 )
         );
         $network_id = $wpdb->insert_id;
 } else {
         $wpdb->insert(
                 $wpdb->site,
                 array(
                         'domain' => $domain,
                         'path'   => $path,
                         'id'     => $network_id,
                 )
         );
 }
 }}}

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


More information about the wp-trac mailing list