Skip to:
Content

bbPress.org

Opened 5 weeks ago

Closed 5 weeks ago

#3699 closed defect (bug) (fixed)

Unchanged reply positions trigger redundant writes

Reported by: johnjamesjacoby Owned by: johnjamesjacoby
Priority: normal Milestone: 2.6.20
Component: Component - Replies Version: 2.1
Severity: minor Keywords:
Cc:

Description

Set an existing reply menu_order to 3, then call bbp_update_reply_position( $reply_id, 3 ) again. The function returns 3 and runs the update/cache-cleaning path instead of returning false without a write.

In the current 2.6 code, $reply_position is normalized to an integer while get_post_field( 'menu_order', $reply_id ) is a string. Their strict comparison cannot match. Normalize the stored value before comparing and add a regression for the unchanged position.

The redundant-write behavior dates back to the 2.1 reply-position function; it is visible in the earliest available 2.1.1 tag, and the 2.6.0 tag contains the mismatched strict comparison. Fix in trunk and backport to branches/2.6 for 2.6.20. Related test coverage: #3695.

Change History (2)

#1 @johnjamesjacoby
5 weeks ago

In 7807:

Replies: Correct ancestry and position comparisons.

Stop threaded reply ancestry at the root instead of appending a zero ID, and compare normalized integer positions so unchanged replies do not trigger redundant writes. Add regression coverage for both cases.

In trunk, for 2.7.

See #3698.
See #3699.
See #3695.

#2 @johnjamesjacoby
5 weeks ago

  • Owner set to johnjamesjacoby
  • Resolution → fixed
  • Status new → closed

In 7808:

Replies: Backport ancestry and position fixes.

Stop reply ancestry before appending an invalid zero ID, and avoid position updates when the stored menu order is unchanged. Add focused PHPUnit regressions for both behaviors.

In branches/2.6, for 2.6.20.

Fixes #3698.
Fixes #3699.

Note: See TracTickets for help on using tickets.