Project:Privatemsg
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

When deleting a user the following error shows up

# 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: DELETE FROM pm_index WHERE mid IN () in /var/www/vhosts/greatmedia.nl/subdomains/###/httpdocs/sites/all/modules/privatemsg/privatemsg.module on line 1251.

Comments

#1

i'm no php-hero but what could be wrong with this line??

      db_query('DELETE FROM {pm_index} WHERE mid IN (' . db_placeholders($mids) . ')', $mids);

#2

The issue is that $mid is empty, aka, the user has not written any messages. This is a bug.

The only thing that needs to be done is to wrap that line inside a "if (!empty($mids) { ". If you can, you are welcome to create a patch if not, I'll do it soon myself. Probably tomorrow.

#3

O no problem if that is the only thing to do, i will create a patch. How do i deliver a patch? just upload it here ?

#4

Yes, just uploading is fine. See http://drupal.org/patch/create if you don't know how to create a patch.

#5

I have read http://drupal.org/patch/create but thats to technical for me. I have altered the file and uploaded it here. Works fine.

AttachmentSizeStatusTest resultOperations
privatemsg.module.patch78.61 KBIgnored: Check issue status.NoneNone

#6

Status:active» needs review

Thanks, but that doesn't help me much since I need to patch file to review your changes.

Attached is a patch that also contains a test case which triggers the bug. Please test.

AttachmentSizeStatusTest resultOperations
user_without_messages_fix.patch2.39 KBIgnored: Check issue status.NoneNone

#7

Status:needs review» fixed

Fixed in 6.x-1.x-dev. 7.x-1.x-dev does not yet contain that feature, I will integrate the bug fix directly into #559180: Delete messages and settings when a user is deleted.

#8

Status:fixed» closed (fixed)

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