[wp-trac] [WordPress Trac] #58041: Fix non-strict checking issue on /wp-admin/includes/upgrade.php file

WordPress Trac noreply at wordpress.org
Sat Apr 1 12:06:40 UTC 2023


#58041: Fix non-strict checking issue on /wp-admin/includes/upgrade.php file
------------------------------+-----------------------------
 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  |
------------------------------+-----------------------------
 This PR fixes a non-strict checking issue on line **1419** of the **/wp-
 admin/includes/upgrade.php** file in WordPress core. The current code uses
 the "==" operator instead of the "===" operator, which can lead to
 unexpected behavior due to type coercion.

 To fix this issue, we replace the "==" operator with the "===" operator to
 perform a strict comparison between the value of the $link->link_category
 variable and the integer 0. This ensures that the comparison is done in a
 type-safe way and that unexpected behavior is avoided.

 The fixed code is as follows:
 {{{#!php
 <?php
 if ( 0 === $link->link_category ) ) {
     continue;
 }
 }}}

 With this fix, the code in the upgrade.php file will be more reliable and
 less prone to unexpected behavior.

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


More information about the wp-trac mailing list