#58042 closed defect (bug) (fixed)
Fix non-strictly checking issue on line 1014 of schema.php
Reported by: | faisalahammad | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | 6.3 |
Component: | Upgrade/Install | Keywords: | has-patch |
Focuses: | coding-standards | Cc: |
Description
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 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, ) ); }
Change History (4)
This ticket was mentioned in PR #4278 on WordPress/wordpress-develop by @faisalahammad.
19 months ago
#1
- Keywords has-patch added; needs-patch removed
#2
@
17 months ago
- Component changed from General to Upgrade/Install
- Milestone changed from Awaiting Review to 6.3
#3
@
17 months ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 55866:
@SergeyBiryukov commented on PR #4278:
17 months ago
#4
Thanks for the PR! Merged in r55866.
Looks like I accidentally missed the props for @audrasjb here, sorry for that! I have updated the props for that commit in the Core Props tool on make/core to fix that.
do we need a doing it wrong notice here?
No, I don't think it's needed. Taking a closer look, populate_network_meta() uses a type cast to int
early in the function, so I used the same approach here 🙂
I found a non-strictly checking issue on line 1014 of the schema.php file in WordPress. To fix this issue, I replaced 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. Please review and merge this pull request. Thank you!
Trac ticket: https://core.trac.wordpress.org/ticket/58042