#5234 closed enhancement (fixed)
widgets.php a while that should be a for loop
| Reported by: | darkdragon | Owned by: | |
|---|---|---|---|
| Priority: | lowest | Milestone: | 2.5 |
| Component: | Optimization | Version: | 2.5 |
| Severity: | trivial | Keywords: | widgets has-patch commit |
| Cc: | Focuses: |
Description
In widgets.php file, contained in register_sidebars(), lines 72-82, there is a while loop that uses $i. It first sets $i to a value, then checks to make sure it is in a range, then it increments $i. I repeat, this is a while loop.
for($i=1; $i <= $number; ++$i)
{
$_args = $args;
if ( $number > 1 ) {
$_args['name'] = isset($args['name']) ? $args['name'] : sprintf(__('Sidebar %d'), $i);
} else {
$_args['name'] = isset($args['name']) ? $args['name'] : __('Sidebar');
}
$_args['id'] = isset($args['id']) ? $args['id'] : "sidebar-$i";
register_sidebar($_args);
}
Attachments (1)
Change History (6)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
(In [6275]) Use a for loop where it's more appropriate. Fixes #5234 props darkdragon and DD32.