Skip to:
Content

BuddyPress.org

Opened 6 years ago

Last modified 6 years ago

#5055 new defect (bug)

BP_Messages_Message::send(): Avoid new thread_id via SELECT MAX()/INSERT

Reported by: wp_jeremy Owned by:
Milestone: Awaiting Contributions Priority: normal
Severity: normal Version: 1.2
Component: Messages Keywords: needs-patch
Cc:

Description

When creating a new thread, Messaging first checks for the MAX({$bp->messages->table_name_messages}.thread_id) before making another query to do its INSERT. During this time, the referenced thread_id may no longer be the max.

A solution is to put MAX() inside the INSERT query: http://stackoverflow.com/a/1587590

After the thread_id is created, a SELECT thread_id can be done on the $wpdb->insert_id row.

Change History (1)

#1 @DJPaul
6 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from 1.7 to 1.2

Thanks. Did you run into this issue on a production site, or just by looking at the code?

Note: See TracTickets for help on using tickets.