[wp-trac] [WordPress Trac] #45825: Use of same loop variable in inner foreach loop can be error-prone
WordPress Trac
noreply at wordpress.org
Fri Jan 4 11:06:20 UTC 2019
#45825: Use of same loop variable in inner foreach loop can be error-prone
------------------------------+------------------------------------
Reporter: subrataemfluence | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Upgrade/Install | Version: 5.0.2
Severity: normal | Keywords: has-patch dev-feedback
Focuses: coding-standards |
------------------------------+------------------------------------
It is not a good practice and not recommended to use the same loop
variable in both outer and inner loop. In `wp-admin/install-helper.php`
function `maybe_drop_column` does the following:
{{{
function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
...
foreach( ... as $column ) {
...
foreach( ... as $columns ) {
...
}
}
}
}}}
I would recommend to change the inner loop variable to `$recheck_column`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45825>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list