Skip to:
Content

bbPress.org

Opened 2 months ago

Closed 2 months ago

#3631 closed defect (bug) (fixed)

WP_Query normalization in WordPress 6.8 breaks _bbp_has_replies_where()

Reported by: johnjamesjacoby's profile johnjamesjacoby Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.6.13 Priority: high
Severity: normal Version: 2.1
Component: Component - Replies Keywords:
Cc:

Description

See: https://core.trac.wordpress.org/ticket/63255

While testing recent changes in the WordPress 6.8 beta, an issue was discovered in the _bbp_has_replies_where() function. The problem stems from a comparison against get( 'post_type' ), which now returns alphabetically sorted values - a change from previous behavior.

The solution (props @vortfu) is to compare the arrays by their differences rather than relying on direct equality.

Attachments (1)

3631-2.6.diff (1.4 KB) - added by johnjamesjacoby 2 months ago.
Diff for the 2.6 branch

Download all attachments as: .zip

Change History (5)

@johnjamesjacoby
2 months ago

Diff for the 2.6 branch

#1 @arl1nd
2 months ago

#3632 was marked as a duplicate.

#3 @johnjamesjacoby
2 months ago

In 7292:

Replies: Fix a bug that causes replies to not appear in some topics.

In WordPress 6.8, WP_Query now enforces a consistent alphabetical order for array values. This change breaks the _bbp_has_replies_where() function, which previously relied on a strict comparison against post_type.

See: https://core.trac.wordpress.org/ticket/59516

This commit replaces the strict comparison with an array_diff() check to account for the new behavior. It also optimizes the surrounding logic to minimize repeated calls to $query->get().

Props @vortfu.

Committed to the 2.6 branch for 2.6.13.

See #3631.

#4 @johnjamesjacoby
2 months ago

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

In 7293:

Replies: Fix a bug that causes replies to not appear in some topics.

In WordPress 6.8, WP_Query now enforces a consistent alphabetical order for array values. This change breaks the _bbp_has_replies_where() function, which previously relied on a strict comparison against post_type.

See: https://core.trac.wordpress.org/ticket/59516

This commit replaces the strict comparison with an array_diff() check to account for the new behavior. It also optimizes the surrounding logic to minimize repeated calls to $query->get().

Props vortfu, arl1nd.

Committed to trunk for 2.7.

Fixes #3631.

Note: See TracTickets for help on using tickets.