Changeset 4173

Show
Ignore:
Timestamp:
09/07/06 17:42:24 (2 years ago)
Author:
ryan
Message:

Avoid infinite loop when category_parent equals cat_ID

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/category-template.php

    r4151 r4173  
    4848        $name = $parent->cat_name; 
    4949 
    50     if ( $parent->category_parent
     50    if ( $parent->category_parent && ($parent->category_parent != $parent->cat_ID)
    5151        $chain .= get_category_parents($parent->category_parent, $link, $separator, $nicename); 
    5252 
  • trunk/wp-includes/category.php

    r4104 r4173  
    173173        $path = '/' . $leaf_path; 
    174174        $curcategory = $category; 
    175         while ($curcategory->category_parent != 0) { 
     175        while ( ($curcategory->category_parent != 0) && ($curcategory->category_parent != $curcategory->cat_ID) ) { 
    176176            $curcategory = $wpdb->get_row("SELECT cat_ID, category_nicename, category_parent FROM $wpdb->categories WHERE cat_ID = '$curcategory->category_parent'"); 
    177177            $path = '/' . $curcategory->category_nicename . $path; 
     
    220220    $category_list = array(); 
    221221    foreach ( $categories as $category ) { 
     222        if ( $category->cat_ID == $category_id ) 
     223            continue; 
     224 
    222225        if ( $category->category_parent == $category_id ) { 
    223226            $category_list[] = $category;