After upgrading to 2.0 I got this error message in my error log: PHP Fatal error: Unsupported operand types in /sites/all/modules/messaging/messaging.module on line 711.

Anyone any clue?

CommentFileSizeAuthor
#33 messaging.patch701 bytesjeremy
#16 messaging-info-array.patch422 bytesnoelbush

Comments

altparty’s picture

When I enable Notifications (2.0), this will make cron time-out or run endless.

altparty’s picture

Status: Active » Closed (fixed)

I've reset the notifications queue and log and the problem disappeared.

altparty’s picture

Status: Closed (fixed) » Active

The problem only disappeared because there were no notifications in the queue.
Looking through the code, I found this (line 711? in messaging.module):

$info += array('glue' => '', 'subject_glue' => '', 'filter' => NULL);

This must be a typo.

altparty’s picture

Category: support » bug
kyle_mathews’s picture

I'm getting the same problem -- emails aren't going through. . . any help? I'm downgrading for now until this issue is fixed.

altparty’s picture

Just remove the '+' for a quick and dirty solution.

David Goode’s picture

Status: Active » Postponed (maintainer needs more info)

Unfortunately not a typo, the += allows the new array to set any previously unset values to the necessary defaults. Most probably something unusable is being passed into the $info array, probably a NULL default. This array depends largely on the send method and message type being used. Do you only get this with certain send methods and not others? If it is systemically wrong it will take some work to track down and any details you can provide on what causes this would be very helpful. Try printing out the arguments to _messaging_info when it is called, maybe starting on line 686 with:

<?PHP
print_r(array('info'=>$info,'method'=>$method,'property'=>$property,'default'=>$default));
?>

Anyone else having this issue? Is it still occurring in latest revisions? Is it only with messages caused by notifications, and what type of notifications? I am unable to reproduce it so far, but obviously extensively testing all contingencies for this module is not that doable. Please describe as precisely as possible the situation precipitating this issue.

Also, try just adding add a check

<?PHP
if(!$info) {
 $info = array();
}
?>

and see if all your messages get sent out properly without the info array properly set.

Thanks,
David

altparty’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Thanks for the support, David.

You convinced me the error message wasn't caused by a typo. So I reverted to the original 2.0 version to see what happened. After 24 hours I still don't see the error messages I saw before. So this must have been caused by something else,

I think this issue can be closed.

presencia’s picture

I just had the same problem. I don't exactly know the reason, but it seems it has now vanished. So I just want to share what I did:

1. First I inserted the check proposed by David:

<?PHP
if(!$info) {
$info = array();
}
?>

That really fixed it for the time being. Emails came through.

2. After that I realized there was some misconfiguration in my website. Some users had phpmailer as sending method, some had E-Mail. But I had deactivated the phpmailer Module. So these subscriptions were made before this deactivation. So now I changed all subscriptions to sending method: E-Mail. After that I changed the messaging.module file to its earlier state (without David's check) and it still worked.

I don't know if this will help anybody but I would be happy if it did.
Thanks for this thread, which made me start tackling this problem in the first place.
~<><~~~~~~~ presencia

kyle_mathews’s picture

The check fixed my problem as well.

I ran this query SELECT DISTINCT send_method FROM notifications and found that there are a number of subscriptions in the database using older depreciated sending methods. I ran a query to change all those subscription's sending_method to the default.

Perhaps when disabling sending_methods, all subscriptions created using that method should be changed to the default?

noelbush’s picture

It might be more to the point just to set a default value for $info so line 700 reads:

function messaging_message_render($message, $info = array()) {

[Update: Sorry, never mind that -- I see that something is getting passed in there, it's just not an array. So you do have to check it like you specified above.]

RikiB’s picture

Im getting this error after upgrading to drupal 6. People used to get messages via mime mail but now use phpmailer.

do I just add that code in the module somewhere?

RikiB’s picture

well uninstalling and reinstalling notifications and messaging fixes it of course. Kinda lame that I lost all those subscriptions but better than the alternative.

sdemircan’s picture

you did not make a patch?

tevih’s picture

subscribe.. Happening to me, too.

Started happening after I removed private messaging.

noelbush’s picture

Priority: Normal » Critical
Status: Closed (fixed) » Needs review
StatusFileSize
new422 bytes

Why is this closed? The issue still occurs in some cases.

How about the simple attached patch? It ensures that $info is an array.

fizk’s picture

+1. I just had this issue, and I haven't changed anything.

Please fix!

orizu’s picture

I also had the issue after an upgrade from Drupal 5 as well as a failure to send notifications.

I forced all outmoded send methods to a working default 'mail' (PHPMailer) which sent those notifications set to immediate, but the cron issue persisted.

The cast in the patch has things running zen-like again.

sherryheinz’s picture

i encountered this error when upgrading from D6 to Pressflow. fixed it by modifying the messaging.module line 711.
would like to see this get checked-in to the source, or any opinions. thanks.

from:
$info += array('glue' => '', 'subject_glue' => '', 'filter' => NULL);

to:
$info = array_merge($info, array('glue' => '', 'subject_glue' => '', 'filter' => NULL));

petednz’s picture

keen to hear if there is an agreed resolution for this - in my case the problem looks like it was fact that some subscriptions were set to a non-existent send method (namely debug which I hadn't re-enabled) so I just went to ../messaging/subscriptions/admin and set all those subs to an existing send method - and sweet - fixed.

lolmaus’s picture

#19 worked for me.

BMorse’s picture

When I tried this modification (in #19) and post something I get this error:

warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/username/public_html/sites/all/modules/messaging/messaging.module on line 711

So, not a universal fix obviously.

dyke it’s picture

subscribe

dyke it’s picture

had the same issue as #20 (debug was being used as a send method but i didn't re-enable it). this appeared to work but then the error showed up again.

solution in #19 seems to have fixed things. i'll report back if i'm still having issues.

thanks for all the help! :)

neochief’s picture

Status: Needs review » Reviewed & tested by the community

#16 resolved issue for me

rbl’s picture

Same issue as described before. #19 solved (so far) for me.

Thanks!

orizu’s picture

This issue popped resurfaced on a test site I had running and unlike #18 where I applied the patch, I found setting values in the notifications_queue to see my cron and queue processing run patchlessly.

(I hadn't retrained ALL illegally specified send_methods in my enthusiasm to apply the patch)

jason.fisher’s picture

Still having this problem. Causing WSOD.

jason.fisher’s picture

Version: 6.x-2.0 » 6.x-2.2
atuline’s picture

Was using Messaging in conjunction with Notifications, but disabled them for a while. I encountered the above error message after enabling the modules. After further testing, it turns out I had not yet enabled the messaging module that was required here. Once enabled, I was off to the races.

Moral of the story: Make sure the appropriate messaging module is enabled.

shraddha.sawant’s picture

Thanks... #30 solved my problem.. I enabled "Simple Mail" module from Messaging Modules.

alpersari’s picture

Hi,

I've solved the problem by adding typecasting operator to #19's code.

The code works for PHP 4.x and 5.x versions:

from:
$info += array('glue' => '', 'subject_glue' => '', 'filter' => NULL);

to:
$info = array_merge((array)$info, array('glue' => '', 'subject_glue' => '', 'filter' => NULL));

jeremy’s picture

StatusFileSize
new701 bytes

The cause of this error seems to be when you've enabled a messaging module type, allowed users to set it as their default message type, and then you disable the module. At that point the following hook call no longer returns the messaging module type:

module_invoke_all('messaging', 'send methods');

This ultimately causes the following to set $info to NULL:

    $info = messaging_method_info($method);

Then in messaging_message_render() the following becomes invalid because you can't += NULL:

  $info += array('glue' => '', 'subject_glue' => '', 'filter' => NULL);

Changing the call to messaging_method_info() to set the default $info to array() solves this problem:

    $info = messaging_method_info($method, NULL, array());

A patch is attached.

Michsk’s picture

Guys, in my case, this had nothing to do with the messaging module it self.

I started with the phpmailer module for sending the notifications trough messaging with phpmailer. Because of my host i had to quit with phpmailer. So i uninstalled the module, from then on i got the error. What i did was go to phpmyadmin and delete all the data that has set the send_method for phpmailer.

Bug fixed.

David Goode’s picture

Yeah, I think perhaps we should instead make disabling a send method reset all notifications that use it to the new default, with the appropriate warnings given on the admin interfaces. Anyone up for that?

David

Michsk’s picture

totally agreed

Anonymous’s picture

Wow, so this bug is almost a year old now and still not fixed? Bad maintainer ... someone help him out with a patch :)

In my case (and it looks like it's the same for all the cases above), I had enabled the PHP Mailer notification module, only to realize that it's useless and disabled it later. Unfortunately some subscriptions had already be set to use PHP mailer. Diabling the module should (but doe *not*) remove those subscriptions. So when the notification cron job runs, it crashes with the above error message since the PHP mailer send method can no longer be found ...

For those with this error, you need to run the following SQL to update your tables:

update notifications set send_method='mail' where send_method='phpmailer'
update notifications_event set send_method='mail' where send_method='phpmailer'

jose reyero’s picture

Status: Reviewed & tested by the community » Fixed

Added some checks so missing sending methods wont cause errors, just a watchdog messge.

Status: Fixed » Closed (fixed)

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

linuxpimp’s picture

Title: Unsupported operand types [see #50 for workaround] » Unsupported operand types
Status: Needs work » Closed (fixed)

I just recreated and fixed this.

My config was as follows:
Pre-upgrade i had messaging debug module enabled but did not enable it post upgrade.
Even though there was no setting to send a debug message when mailing, this was causing the error. Enabling it again solved the error message problem.
----
wireless router reviews

tsorelle’s picture

I am experiencing this problem. Very Frustrating! The posts suggest that the problem seems to stem from a variety of configuration problems and I appreciate that it may be hard to trace. However, it seems to me that the module should detect the problem and log an error somewhere rather than breaking the CRON process. This is a bug of its own. Code that runs in cron need to do better exception handling.

Why does this issue keep getting closed with no resolution?

tsorelle’s picture

Turned out that my problem was a disabled module, as suggested in a couple of the posts above. But it took me hours to figure it out. So I hope you will forgive my grumpiness. Please consider introducing code that would catch this condition (attempting to use a disabled module to send mail) and log the problem.

tibbsa’s picture

I'm not sure if this is fixed in the latest development version, but I ran into this tonight. The problem seemed to be that "messaging" was enabled to go along with Organic Groups, but no message sending methods were enabled. This resulted in several items being added to the queue with "no" sending method defined, which seemed to be triggering these errors.

tribsinpa’s picture

I also had a problem with disabling the Messaging Debug module however had some users with "Debug" still used as the send method.

Fix:
on /admin/messaging/subscriptions/admin: Changed the user's send method who had "debug" set
FROM phpMyAdmin ran the sql query: DELETE FROM `notifications_queue` where send_method='debug'

I imagine this would also happen with another "send_method" that was previously used but not cleared from the database tables.

christefano’s picture

Status: Closed (fixed) » Active

Hmm, this doesn't seem fixed to me. At admin/messaging/subscriptions on a site I'm working on I see thousands of subscriptions that are still using mimemail even though MIME Mail has been disabled and uninstalled.

fizk’s picture

I'm getting this error too. This bug doesn't want to die!

I have hundreds of lines of just this:

[18-Jun-2010 11:30:01] PHP Fatal error: Unsupported operand types in /var/www/drupal/sites/all/modules/messaging/messaging.module on line 71

christefano’s picture

We fixed this by running UPDATE notifications SET send_method='mail' WHERE send_method='mimemail' on our database. It would be good to be able to run this query on a new admin/messaging/subscriptions/tools page.

jose reyero’s picture

Status: Active » Fixed

This seems to happen when trying to send messages for disabled methods. This should be fixed in latest version (-dev), messages are not attempted to be sent anymore and a log is produced.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Status: Closed (fixed) » Active

Bug still present. Methinks the maintainer has abandoned this module :(

Running these two queries fixed the issue:

update notifications set send_method='mail' where send_method='phpmailer'
update `notifications_queue` set send_method='mail' where send_method='phpmailer'

Strange thing though is that I'm sure I fixed this issue 3 months ago using the same technique. It seems that when I have new users register on my site for some reason they get phpmailer set for thread notification ....

edvanleeuwen’s picture

I hadthe same problem with this version. The cron problem was solved by issuing the update command.

lolmaus’s picture

Title: Unsupported operand types » Unsupported operand types [see #50 for workaround]
Status: Active » Needs work

Okay, we've got a workaround, but a patch is still needed to prevent the issue.

Status: Closed (fixed) » Needs work