Opened 13 years ago
Last modified 13 years ago
#5055 new defect (bug)
BP_Messages_Message::send(): Avoid new thread_id via SELECT MAX()/INSERT
| Reported by: | wp_jeremy | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Contributions |
| Component: | Messages | Version: | 1.2 |
| Severity: | normal | 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)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Thanks. Did you run into this issue on a production site, or just by looking at the code?