WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 12 days ago

Last modified 12 days 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:
PR Number:

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 3 months ago.
remove caching from get_all_category_ids function

Download all attachments as: .zip

Change History (6)

#1 @johnjamesjacoby
3 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
3 months ago

remove caching from get_all_category_ids function

#2 @itowhid06
2 months ago

  • Keywords has-patch added

#3 @SergeyBiryukov
12 days ago

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

#4 @SergeyBiryukov
12 days ago

Some history on the 'all_category_ids' cache key:

Last edited 12 days ago by SergeyBiryukov (previous) (diff)

#5 @SergeyBiryukov
12 days 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.