Closed (fixed)
Project:
Mollom
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
9 Nov 2008 at 01:06 UTC
Updated:
6 Aug 2009 at 20:43 UTC
Jump to comment: Most recent file
I get the error: Fatal error: [] operator not supported for strings on line 271, and here is a patch to avoid that.
Patch is against DRUPAL-6--1.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | 331960-mollom-mail-alter-D6.patch | 1.05 KB | dave reid |
| mollom-fatal.patch | 869 bytes | kbahey |
Comments
Comment #1
s.daniel commentedI'll test the patch as I have the same problem but not tonight so just tracking plus a link to what seems to be a dup: http://drupal.org/node/287613
Comment #2
s.daniel commentedTested as working. Can't say much about what exactly the change does though only so much - it fixes the problem.
Comment #3
dries commentedBefore I commit this patch, I'd like to understand how I can reproduce this and why $message['body'] is not always an array. Can you try to reproduce this problem and do some digging? Ideally, I'd want to write a test case for this.
Comment #4
s.daniel commentedCouldn't quickly reproduce the error.
I started with a fresh Acquia Drupal install on the same cheap hosting envoirenment at 1&1 activated Mollum and entered the same keys as on the site the error was appearing before the patch (Hope I was allowed to do so). I have a couple of contrib modules enabled on the site but not the time right now to test one by one (simpletest yeah! ;) - I'll do further tests over the weekend if neccecary, however if someone could point me to a module to test first that might save some time.
These are the modules I have Installed currently
edit: The error appeared when someone tryed to register a new user. The user was created but no email was sent.
Comment #5
kbahey commentedIn my case it was regular community Drupal, and I think it was in conjunction with an older version of the comment_notify module (which had an overhaul since then) or the notify module (which I had uninstalled since then).
I think it was trying to send the email out that one of these modules sends.
Comment #6
dries commentedThe Mollom module doesn't have tests for the contact form, I believe. A good starting point would be to help write tests for the contact form. Once we have the tests, we can run them on sites that have all these additional modules installed or that can reproduce the problem.
Comment #7
domesticat commentedOne of my users is reporting getting this error when she posts a comment. I'm guessing it's the firing out of tokenized emails due to comment_subscribe, etc. I haven't applied the patch yet. Let me know what I can do to help test.
Comment #8
SimonVlc commentedSame problem here, I think that in combination with the comment subscribe module.
Testing the patch. Thanks for it, Simon ;).
Comment #9
domesticat commentedPatch works for me.
Comment #10
gondwanan commentedI'm getting this on registration with Mollom 6.x-1.6 and Drupal 6.8
- I don't have comment_notify installed.
Comment #11
fumbling commentedI just got this when posting a comment:
Fatal error: [] operator not supported for strings in /var/www/html/sites/all/modules/mollom/mollom.module on line 271I had just made a few changes to the settings for the Notifications module, and I have no idea if that's a coincidence or if it's related. I'll try the patch as soon as I can. Thanks.
Comment #12
fumbling commentedAs a quick follow up, is this patch still valid for Drupal 6.9 and Mollom 6.x-1.7? Forgive me if that's a newbie question...
Comment #13
dries commented@fumbling, I don't know because I have not been able to reproduce this problem. I'm guessing that this is a bug in another module that negatively impacts Mollom. In absence of a bug report with clear steps as how to reproduce this problem starting from a clean Drupal 6 install, I'd appreciate any help debugging this. I'm marking this issue 'needs more info'.
Comment #14
aztechnetworks commentedI have the same issue when a user enters a comment.
I also have comment_subscribe module in use.
I will test the patch now.
Using latest versions of Mollom and comments_subscribe.
Comment #15
dries commentedI spent some time looking at the comment_subscribe module but they don't implement the mail_alter hook. It seems like that module is not to blame. Can you grep your site's source code tree for 'mail_alter' (or 'alter_mail')?
Comment #16
mactoph commentedI'm getting the same error:
Fatal error: [] operator not supported for strings in /home/.fret/nrcpadmin/nrcpara.org/sites/all/modules/mollom/mollom.module on line 271
I don't have comment_subscribe installed, but I do have Watcher. I did a search for 'mail_alter' and 'alter_mail' in all of the modules I have installed and didn't find anything?
Comment #17
dave reidI'm pretty sure the problem at hand is that modules can either pass an array or a string as a mail 'body' to drupal_mail(). Watcher and comment_subscribe use a string instead of an array.
Note that the message body doesn't 'officially' become an array until after mail_alter calls are finished (see drupal_mail):
Since neither an array or a string is the 'official' way to send the mail body (although all core examples use arrays), we can just rework mollom_mail_alter to be a little more flexible.
Comment #18
dave reidComment #19
lastnico commentedThis error could appear using the comment_subscribe module.
The patch from http://drupal.org/node/331960#comment-1428512 is valid and works for me. Please apply it.
Comment #20
dries commentedLooks good to me. Dave, could you add some code comments to explain that the hook takes book an array and a string. It is a bit awkward so I think it is worth documenting. Thanks!
Comment #21
dries commentedAdded a code comment myself and committed it to DRUPAL-6. Thanks!
I think we should fix this in Drupal 7 so I'm marking this 'needs work' until we created a core issue for it.
Comment #22
dave reidCreated core issue #448908: Only allow $message['body'] to be an array in drupal_mail() / hook_mail_alter() for fixing this issue in core. Now marking this issue as fixed.
Comment #23
seaneffel commentedI can turn up some more information. I'm using OG 6.x-1.3, Notifications 6.x-2.0 and Mollom 6.x-1.7 together.
I have a long chain of errors for each time a user submits content to an OG group. In my use case, users can only be subscribed to new content published in OG groups. The Drupal error log around the time of each of these postings started with these messages.
When a user submits a node, this is the sequence of log/client errors:
Then the node is submitted and this message is displayed to the user:
The error log turns up this entry:
And then this one.
Then then there is an error for each outgoing notification (one for each subscribed user):
The notifications do get delivered.
After running the patch above from Dave, at least the Mollom errors are not happening anymore. Does this patch need to consider any of the other details I listed from Notifications and CCK errors?
Comment #24
dave reidThis has already been fixed in the latest 6.x-1.x-dev version of Mollom. The other bugs are only related to the other modules, so you'll want to file separate patches for those modules.
Comment #25
seaneffel commentedOK, so Dries committed the patch #18 but there isn't any newer version of the Mollom module. I'm confused, is the fix in the module or is the fix in core?
Comment #27
jwilson3I've hit this bug also. Is there no way a stable release can be cut that includes this fix?Or at least the final patch file provided here for those that don't want to move to dev branch?Doh, me and my big mouth. I figured my code was uptodate but it wasnt... I upped to the latest version 6.x-1.9. sorry, i'll shutup now.