Warning returned after successfully sending invitations
| Project: | Invite |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | minor |
| Assigned: | mac_perlinski |
| Status: | reviewed & tested by the community |
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
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
#2
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
Yes this is the same problem, it will fix your problem and yes it is safe to use.
Mac
#4
i just tried it and same result...the second person gets 'Array' as the personalized message added to the invite.
#5
Subscribing...
#6
I can still only send one invite at a time...
#7
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
#8
Works for me!
#9
Thank you!
#10
Looks good.
#11
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
Patch #7 is expensive - change only $message in loop is enough.
#13
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
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.