Deleting user causes mysql error
lasac - November 8, 2009 - 10:04
| Project: | Privatemsg |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
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.
#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.
#6
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.
#7
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
Automatically closed -- issue fixed for 2 weeks with no activity.