[wp-trac] Re: [WordPress Trac] #9661: cat_row doesn't not list all
categories
WordPress Trac
wp-trac at lists.automattic.com
Tue Apr 28 01:10:56 GMT 2009
#9661: cat_row doesn't not list all categories
--------------------------+-------------------------------------------------
Reporter: hailin | Owner: anonymous
Type: defect (bug) | Status: closed
Priority: normal | Milestone: Unassigned
Component: General | Version:
Severity: normal | Resolution: invalid
Keywords: |
--------------------------+-------------------------------------------------
Changes (by hakre):
* status: new => closed
* resolution: => invalid
Comment:
Replying to [ticket:9661 hailin]:
> [...] The key reason is that within loop
>
> foreach ( $categories as $category )
> ...
> unset($categories[$i]) //Prune the working set
>
> We can not unset an element while the foreach loop is traversing the
array, because it causes the internal PHP cursor to jump ahead, leaving
out valid elements.
That is not true. foreach() works on a copy of the array so you do not
manipulate the array pointer while removing one element from the (source)
array while iterating over a copy of the (source) array. compare to
http://de.php.net/manual/en/control-structures.foreach.php .
since you name that beign the "key reason" I assume that your report is
invalid. I therefore close it as invalid. Feel free to provide more info
and reopen it.
Please name the wordpress version you provided the patch for.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9661#comment:2>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list