messaging_privatemsg: incorrect signature for call to privatemsg_new_thread
Barrett - May 15, 2009 - 20:05
| Project: | Messaging |
| Version: | 6.x-2.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
messaging_privatemsg, in the messaging_privatemsg_send_msg function is making a call to privatemsg_new_thread using the following line (line 46), where $sender is a user object:
<?php
return (bool)privatemsg_new_thread($message->subject, $message->body, $recipients, $sender);
?>The function definition for privatemsg_new_thread though defines the call signature as
<?php
function privatemsg_new_thread($recipients, $subject, $body = NULL, $options = array())
?>This is causing failures when the message processes through cron
Fatal error: Unsupported operand types in /var/www/defstar/drupal/sites/all/modules/privatemsg/privatemsg.module on line 1158

#1
Similar problem on cron:
Fatal error: Call to undefined function privatemsg_new_thread() in /home/.mitaine/user/example.com/sites/all/modules/messaging/messaging_privatemsg/messaging_privatemsg.module on line 46
Related Enabled Modules:
Private messages 6.x-1.0-rc2
Messaging 6.x-2.0
Messaging Privatemsg 6.x-2.0
Content Notifications 6.x-2.0
Notifications 6.x-2.0
Notifications Lite 6.x-2.0
Notifications UI 6.x-2.0
Notifications Views 6.x-2.0
Organic Groups Notifications 6.x-1.3
I don't understand why his is suddenly happening. Cron hasn't run in 13+ hours
#2
Tried reverting to 2.0beta6 with no immediate success.
Disabling Private Messages and Messaging Privatemsg while enabling Simple Messaging allowed cron to run. I believe this is not a viable solution for most instances, but I thought the info might help.
Re-Enabled Private Messages with Messaging Pritavemsg still disabled and it works. Tested messaging and cron with no problems but now there are 2 message systems for users.
#3
I **think** the code below is working, but I've been staring at it so long I'm a bit cross-eyed. Can someone please confirm (or deny)?
Replace messaging/messaging_privatemsg/messaging_privatemsg.module line 46 with:
<?phpreturn (bool)privatemsg_new_thread($recipients, $message->subject, $message->body);
?>
#4
Thanks for the info. I have uploaded a slightly modified patch which makes the code as following:
<?php$ret = privatemsg_new_thread($recipients, $message->subject, $message->body, array('author' => $sender));
return $ret['success'];
?>
This reflects a new return value from the method as well as allows the user to be set by messaging, which is required because messaging is often called without the $user array being properly set. The patch is attached. See this issue I posted about the API for privatemsg being wrong: http://drupal.org/node/474736 . I haven't tested this beyond the fact that it parses--please, if you are using this functionality and having problems, try this out and see if it works. I will try to do the same over the next couple days when possible and then get it committed.
Thanks,
David
#5
I sucessfully tested the above patch and committed it to DRUPAL-6--2. Please test it out and comment if you find any further issues.
#6
I'll try it in the next day or 2.
What's the relationship between this patch and the one at http://blog.worldempire.ch/api/function/privatemsg_new_thread/1 ??
#7
I applied the patch via ssh and am now getting the same error on line 47:
$ret = privatemsg_new_thread($recipients, $message->subject, $message->body, array('author' => $sender));
Everything seemed to be working until I sent a OG Broadcast. Could this be related?
Drupal 6.10, everything else latest stable ver.
#8
I'm unable to reproduce this error. Did you download the latest DRUPAL-6--2 branch of messaging and the current private_msg? Can you provide more details on what went wrong? Is anyone else having problems?
Thanks,
David
#9
I was getting the same problem - you need the latest dev branch of private_msg (6.x-1.x-dev at time of post), rather than the latest stable (6.x-1.0-rc2).
Simon
#10
Good catch. I'm not sure how rapidly the privatemsg module is changing, but it seems this API call isn't present in the current rc2. If another release comes out for privatemsg that still doesn't support this, feel free to comment in this thread, or ideally to get them to include the functionality on that module's issue queue if you need it.
Thanks,
David
#11
I see this same issue.
It isn't fixed!
#12
Do you have the dev head of both modules? Has something changed in private msg head since the patch?
Thanks,
David
#13
Ugh, I came back to correct my post but it didn't save. I was in a spot with an awful connection. I apologize.
I did not have dev privatemsg properly installed at the time when I was saying it wasn't fixed. Turns out that, all around, dev privatemsg is ten times better than the next stable release by leaps and bounds. Everything works perfectly too.
Sorry for the confusion.
#14
Just fyi, related issue here, #491364: privatemsg hook - wrong access string
#15
Still getting
Fatal error: Call to undefined function privatemsg_new_thread()
And I cannot find the function anywhere in the privatemsg module... (using latest supported release)
#16
Lacking a stable release of privatemsg, we are using the -dev release.
#17
Just to rant...it's really disappointing how about 75% of the 'stable' modules I'm using have critical flaws..
How is the privatemsg dev? Any known bugs yet? Serious ones..?
#18
Subscribing
#19
I just logged into my site as admin and created an organic group.
Then saw this messge.
Fatal error: Call to undefined function privatemsg_new_thread() in /home/rainchil/public_html/sites/all/modules/messaging/messaging_privatemsg/messaging_privatemsg.module on line 47
When I refreshed the message was gone.
The content_type og does not have any privatemsg functionality I think?
So wondering what happened.
Seems nobody else was logged in at the time and cron had run 24mins earlier.
Privatemsg 6.x-1.0-rc2
Drupal 6.13
Content Notifications 6.x-2.1
Messaging 6.x-2.1
Messaging Privatemsg 6.x-2.1
Would it have been triggered by notifications?
Do I need to use a dev version? Which modules?
#20
See #9
#21
Automatically closed -- issue fixed for 2 weeks with no activity.