Warning returned after successfully sending invitations

jessia - October 23, 2008 - 00:44
Project:Invite
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:minor
Assigned:mac_perlinski
Status:reviewed & tested by the community
Description

The invitations shown on this page haven't been accepted yet. The status deleted means the user account has been terminated.

warning: preg_match() expects parameter 2 to be string, array given in /hsphere/local/home/jessia/starpals.org/includes/bootstrap.inc on line 723.
warning: preg_match() expects parameter 2 to be string, array given in /hsphere/local/home/jessia/starpals.org/includes/bootstrap.inc on line 723.
warning: preg_match() expects parameter 2 to be string, array given in /hsphere/local/home/jessia/starpals.org/includes/bootstrap.inc on line 723.
warning: preg_match() expects parameter 2 to be string, array given in /hsphere/local/home/jessia/starpals.org/includes/bootstrap.inc on line 723.
warning: preg_match() expects parameter 2 to be string, array given in /hsphere/local/home/jessia/starpals.org/includes/bootstrap.inc on line 723.
warning: preg_match() expects parameter 2 to be string, array given in /hsphere/local/home/jessia/starpals.org/includes/bootstrap.inc on line 723.
warning: preg_match() expects parameter 2 to be string, array given in /hsphere/local/home/jessia/starpals.org/includes/bootstrap.inc on line 723.
warning: preg_match() expects parameter 2 to be string, array given in /hsphere/local/home/jessia/starpals.org/includes/bootstrap.inc on line 723.

9 invitations have been successfully sent. You will be notified when any invitee joins the site.

The invites appear to have gone through, but I got this warning on the confirmation page. I don't actually know what this warning means, but I thought I should submit it.

#1

mac_perlinski - December 10, 2008 - 03:34
Assigned to:Anonymous» mac_perlinski
Status:active» needs review

Ok there this patch needs review, I just checked php backtrace which showed that preg_match problem is due to check_plain function in invite_token.inc.
I'm attaching patch but this code needs review as i haven't had time to check all possible outcomes of this fix.
Maybe we should check plain somewhere else?
Note problem only exists when we have 2 or more email addresses in $form['email'] element for one email it works perfect.

Anyway looking forward some feedback from you guys when you review it.
-
Mac
maciej.perlinski@meant4.com

AttachmentSize
invite_token.patch 684 bytes

#2

mdowsett - January 30, 2009 - 19:55

I'm having a similar error being reported:

warning: preg_match() expects parameter 2 to be string, array given in /home/viparagl/public_html/matheson/includes/bootstrap.inc on line 761.

It happens only when I send invites to more than one email at a time. I've tried putting the emails on separate lines or just separating them by a comma.

The invites do go out, but the non-first person on the list doesn't get the custom message inviters can add. Instead they get a message that reads "Array".

Questions:
1) should your patch fix this error as well?
2) is the patch safe to use?

#3

mac_perlinski - February 3, 2009 - 18:36

Yes this is the same problem, it will fix your problem and yes it is safe to use.

Mac

#4

mdowsett - February 3, 2009 - 19:03

i just tried it and same result...the second person gets 'Array' as the personalized message added to the invite.

#5

paganwinter - February 18, 2009 - 10:49

Subscribing...

#6

mdowsett - February 25, 2009 - 05:05

I can still only send one invite at a time...

#7

Barrett - March 25, 2009 - 14:54

I think the problem was more basic than that, Mac. That field should be using check_plain.

I poked around and it seems to me that the problem stems from the use of the $message variable in multiple contexts (i.e., for the body of he message to be sent, to capture output of the drupal_mail call, and as the body of the message displayed on-screen to the sender) within invite_form_submit(). Changing that function to use a distinct variable name for the different contexts seems to have done the job on my system.

I'm attaching a patch. Please let me know what y'all think.

Barrett

AttachmentSize
invite_form_submit.patch 2.31 KB

#8

paul2 - March 25, 2009 - 20:57

Works for me!

#9

aluminium - April 13, 2009 - 21:37

Thank you!

#10

ckng - June 22, 2009 - 09:48
Status:needs review» reviewed & tested by the community

Looks good.

#11

Delta Bridges - July 22, 2009 - 12:14

Hello there,
Has this patch been committed yet?
I am still getting the preg_match() expects parameter 2 to be string error.... and I have the latest stable version of Invite module.... from 19 april 2009 :)
Many thanks!
JJ

#12

andypost - July 25, 2009 - 02:04

Patch #7 is expensive - change only $message in loop is enough.

AttachmentSize
invite_send.patch 773 bytes

#13

rudders - July 29, 2009 - 19:59

Will this patch be committed anytime soon . . . appears to be no contributor comments in this thread for a long time! Is this module in need of new maintainers??

#14

friolator - November 6, 2009 - 22:21

I can confirm that this patch works as advertised. Would be nice to get this committed. We just realized that 100+ invites went out without critical text attached. ugh.

 
 

Drupal is a registered trademark of Dries Buytaert.