WordPress.org

Make WordPress Core

Opened 13 months ago

Closed 11 months ago

Last modified 11 months ago

#48176 closed defect (bug) (fixed)

Deprecated get_all_category_ids() call can return incorrect results

Reported by: johnjamesjacoby Owned by: SergeyBiryukov
Milestone: 5.4 Priority: low
Severity: minor Version: 4.0
Component: Taxonomy Keywords: 2nd-opinion has-patch
Focuses: Cc:

Description

In WordPress 4.0.0 and r28679, the get_all_category_ids() function was formally deprecated.

Internally, it continues to rely on a cache key (all_category_ids) that will never be repopulated.

This means anyone still using this deprecated function (yikes, I know...) on an installation with a persistent object cache is highly likely to be retrieving invalid/unexpected results.

Attachments (1)

48176.diff (808 bytes) - added by itowhid06 13 months ago.
remove caching from get_all_category_ids function

Download all attachments as: .zip

Change History (6)

#1 @johnjamesjacoby
13 months ago

Recommend to simply remove caching from this deprecated function completely.

At this point, anyone still using it is not likely doing so for the performance benefit, and get_terms combined with WP_Term_Query now provides caching by default.

@itowhid06
13 months ago

remove caching from get_all_category_ids function

#2 @itowhid06
13 months ago

  • Keywords has-patch added

#3 @SergeyBiryukov
11 months ago

  • Milestone changed from Awaiting Review to 5.4
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#4 @SergeyBiryukov
11 months ago

Some history on the 'all_category_ids' cache key:

Last edited 11 months ago by SergeyBiryukov (previous) (diff)

#5 @SergeyBiryukov
11 months ago

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

In 46810:

Taxonomy: Remove redundant caching from get_all_category_ids(), deprecated in favor of get_terms() in [28679].

The all_category_ids cache key it relied on was removed in [5555] and never repopulated, causing invalid or unexpected results when using a persistent object cache.

Props itowhid06, johnjamesjacoby.
Fixes #48176.

Note: See TracTickets for help on using tickets.