Skip to:

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#5503 closed defect (bug) (fixed)

possible fatal in bp_groups_prefetch_activity_object_data() when no group to fetch

Reported by: djpaul's profile DJPaul Owned by: boonebgorges's profile boonebgorges
Milestone: 2.0 Priority: highest
Severity: critical Version: 2.0
Component: Groups Keywords:


All of a sudden I seem to be having weird environment problems with BuddyPress. I haven't figured that out yet, but whatever's going on, led to a nice fatal:

[31-Mar-2014 20:10:24 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 for query SELECT * FROM wp_bp_groups WHERE id IN () made by
require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/twentyfourteen/page.php'), get_template_part, locate_template, load_template, require('/themes/twentyfourteen/content-page.php'), the_content, apply_filters('the_content'), call_user_func_array, bp_replace_the_content, apply_filters('bp_replace_the_content'), call_user_func_array, BP_Groups_Theme_Compat->single_content, bp_buffer_template_part, bp_get_template_part, bp_locate_template, load_template, require('/plugins/buddypress/bp-templates/bp-legacy/buddypress/groups/single/home.php'), bp_get_template_part, bp_locate_template, load_template, require('/plugins/buddypress/bp-templates/bp-legacy/buddypress/groups/single/activity.php'), bp_get_template_part, bp_locate_template, load_template, require('/plugins/buddypress/bp-templates/bp-legacy/buddypress/activity/activity-loop.php'), bp_has_activities, BP_Activity_Template->construct, bp_activity_get, BP_Activity_Activity::get, BP_Activity_Activity::prefetch_object_data, apply_filters('bp_activity_prefetch_object_data'), call_user_func_array, bp_groups_prefetch_activity_object_data

There's a route through bp_groups_prefetch_activity_object_data() where $uncached_ids can be set to an empty array, and when it's used with the wp_parse_id_list() function, it returns an empty string, leading to the malformed SQL error as per this ticket description.

I am getting this on the /groups/mygroup/ screen (i.e. activity view).

Change History (3)

#1 @boonebgorges
9 years ago

  • Priority changed from normal to highest
  • Severity changed from normal to critical
  • Version set to 2.0

Thanks for the report. Looks like this is happening because the current group is already in your cache. We should just be bailing from the uncached_ids query when there's nothing to query. Tests and fix incoming.

#2 @boonebgorges
9 years ago

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

In 8224:

When prefetching group data for an activity loop, avoid the query when there's nothing to fetch

When there are no uncached_ids, don't attempt to query. There's nothing to get,
and it will result in an invalidly formatted SQL query.

Fixes #5503

This ticket was mentioned in IRC in #buddypress-dev by boonebgorges. View the logs.

9 years ago

Note: See TracTickets for help on using tickets.