Make WordPress Core

Opened 6 years ago

Closed 8 months ago

#7267 closed defect (bug) (invalid)

Infinite recursion in get_category_parents() and _children()

Reported by: tellyworth Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch irish-coffee
Focuses: Cc:


These two functions can get stuck in a recursion loop if there's an indirect category hierarchy loop like A -> B -> C -> A.

The patch keeps track of traversed IDs and prevents repetition - there's a name for the algorithm but it escapes me. It increases memory usage but probably not too much - certainly less than infinite recursion does.

Attachments (1)

prevent-category-looping-r8296.patch (1.8 KB) - added by tellyworth 6 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 ryan6 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [8299]) Prevent category looping. Props tellyworth. fixes #7267

comment:2 nacin3 years ago

  • Milestone changed from 2.6 to Future Release
  • Resolution fixed deleted
  • Status changed from closed to reopened

This should be able to leverage wp_check_term_hierarchy_for_loops() now.

comment:3 avryl8 months ago

  • Component changed from General to Taxonomy

comment:4 wonderboymusic8 months ago

  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from reopened to closed

These funcs have been deprecated in the 3 years since this patch was last looked at

Note: See TracTickets for help on using tickets.