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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
In 7807: