I was just looking through the d.o watchdog logs for PHP errors and found this one:
http://drupal.org/admin/reports/event/477637328

User warning: 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 query: SELECT uid, level, mail_body, mail_subject_project, mail_subject_category FROM project_issue_notification_global WHERE uid IN () in _db_query() (line 147 of /var/www/drupal.org/htdocs/includes/database.mysqli.inc).

This is from #1304594: Consolidate queries for user notification preferences. Basically, we never see if $recipients is empty. We should probably do two things to fix this:

A) Make project_issue_notification_user_settings_load_multiple() more resilient if you pass it an empty array so it doesn't generate a bogus query.

B) Inside project_issue_mail_notify() once we're done collecting potential recipients check if the array is empty, and if so, bail out early.

CommentFileSizeAuthor
#1 1321190-0.patch681 bytesKjartan

Comments

Kjartan’s picture

Status: Active » Needs review
StatusFileSize
new681 bytes

Here is a patch that adds a check in project_issue_mail_notify() to make sure we have recipients.

Not sure about adding a check in project_issue_notification_user_settings_load_multiple(), seems unnecessary as it is an internal function that is called in two places (the other call will always pass a uid).

drumm’s picture

Status: Needs review » Fixed

Looks good. For (B), we don't want to completely bail, since it looks like there are more mails being sent, so this should work.

Automatically closed -- issue fixed for 2 weeks with no activity.