Closed (fixed)
Project:
Webform
Version:
6.x-3.11
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 May 2011 at 04:48 UTC
Updated:
19 Oct 2011 at 12:49 UTC
Jump to comment: Most recent file
After upgrade webform 3.11 security update, I got this error.
warning: Invalid argument supplied for foreach() in /sites/all/modules/mimemail/mimemail.inc on line 359.
warning: Cannot use a scalar value as an array in /sites/all/modules/webform/includes/webform.submissions.inc on line 269.
warning: Invalid argument supplied for foreach() in /sites/all/modules/mimemail/mimemail.inc on line 359.
to create this error
1. fill in a webform
2. submit it
3. error display in confirmation page.
So I downgrade the security webform update now.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | 1162112-17.patch | 1.31 KB | roderik |
| #14 | 1162112-14.patch | 584 bytes | roderik |
| #4 | webform.submissions.inc_.diff | 895 bytes | luti |
Comments
Comment #1
sgabe commentedSo this is a Webform issue.
Comment #2
weseze commentedI can not reproduce this...
Comment #3
luti commentedSame here. Mime Mail 6.x-1.0-alpha8, Webform 6.x-3.11, "Include files as attachments" setting not checked (unselected).
Error message:
which is:
within mimemail_html_body() function ($attachments shall be an array).
Doesn't look nice, but a message still arrives as expected.
Comment #4
luti commentedHeh,
we set (line 269):
but immediately in next line (line 272), we set $message array (loosing $message['attachments']):
I've switched those 2 lines, and it seems to be OK now (a patch is attached).
Comment #5
quicksketchOh hmm, that's not very smart. The intention was to allow #1087796: Allow altering of attachments in hook_mail_alter(). I think this means that we need to keep the line where it is, but it should be assigned to $mail_params, not to $messages.
Comment #6
ceege111 commented#4 Switching these 2 lines worked for me. Not sure about the implications. Using mime mail.
Comment #7
luti commentedI have the attachment option unchecked, so don't care very much about the details (implications) at the moment. I've just had to remove the unpleasant error message for my production site, and as I've seen I am loosing the variable through this call, I am setting it after...
By the way, what should hook_mail_alter() do with the attachments? If I attach a file, I normally don't want it to be renamed (or even the content to be changed anyhow)...
Comment #8
esbon commented#6 I am on the same boat. Hopefully we will have a final solution soon!
Comment #9
Brainwrap commentedYep, I'm having the same issue; here's the full error code that comes up every time I submit a form (the submission goes through fine, but the warning code appears):
Note: I just tried swapping lines 269 & 272 (per #4 above) webform.submissions.inc and can confirm that it seems to have fixed the issue (well, the errors went away, anyway).
Comment #10
cesar.brod@gmail.com commentedSame here... Applied the line switch suggested by #4
Comment #11
Rainman commentedanother here, same results errors go away after switching the suggested lines.
an additional error came up with the upgrade from 6.2 due to previous use of header theming for HTML email found here: http://drupal.org/node/270472
Comment #12
creeksideplayers commentedI'm seeing the same error with line 269, and I applied the line switch suggested by #4, and it worked for me.
Comment #13
Balbo commentedSame here.
Switch as in #4 applied.
Comment #14
roderik@quicksketch / #5: ah, that figures.
(Indeed, that's consistent with #1087796-6: Allow altering of attachments in hook_mail_alter(). This got rid of the error; I didn't test attachments though. #1087796 has already done that anyway.)
Comment #15
luti commented@roderik,
I've applied your patch, but still get the same message as above (invalid argument supplied...). As said, with no attachment and attachment option unchecked. Have you tested your patch, or just made it (according to #5)? ;-)
Comment #16
brei9000 commented@roderik,
Patch did not work for me either.
Comment #17
roderikI tested... and got rid of the error I saw, which was only the "Cannot use a scalar value as an array" leading me to this issue.
I didn't get the other error because I was still on mimemail 6.x-1.0-alpha6. Now, on mimemail 6.x-1.0-alpha8, I get the other "Invalid argument supplied for foreach()".
Here's a new one.
It seems that $message['attachments'] is incorrect; the attachments do not live there and never have. $mail_params is returned as $message['params'].
Comment #18
mmariott commentedAfter upgrading from webform 6.x-3.9 to webform 6.x-3.11, I got the same error reported at the beginning of this thread:
warning: Invalid argument supplied for foreach() in /sites/all/modules/mimemail/mimemail.inc on line 359.
warning: Cannot use a scalar value as an array in /sites/all/modules/webform/includes/webform.submissions.inc on line 269.
warning: Invalid argument supplied for foreach() in /sites/all/modules/mimemail/mimemail.inc on line 359.
I just replaced the newer modules/webform/includes/webform.submissions.inc (6.x-3.11)
with the older modules/webform/includes/webform.submissions.inc (6.x-3.9)
and the error disappeared.
So for the future release of webform the old version of this file could be kept, just applying "security related" changes
Comment #19
quicksketchYikes! I would NOT recommend keeping some files from Webform but not others. If you want just the security related changes, use the 3.10 version (since that's exactly what it is, 3.9 with nothing but security fixes).
Comment #20
star-szrSubscribe
Comment #21
luti commentedSeems to work now, at least with my settings (no errors displayed). Thanks.
Comment #22
demma10 commentedI applied the patch in comment #17 and it removes both errors. Thanks for the patch.
I haven't tested with attachments as files ticked, none of my forms use that setting.
Comment #23
quicksketch#17 worked for me too. Tested it and it makes all the e-mails come through again with MIME Mail. I've committed this patch to the 6.x branch, D7 seems like it's working fine without these changes (which is probably why I didn't notice the first time). Thank roderik!
Comment #24
Brainwrap commentedIt's great that the #17 patch works, but I used the swap-lines-269-and-272 solution for like a dozen sites...is there any reason I shouldn't just leave those as is for the time being?
Comment #25
roderik@Brainwrap: the only reason for having to switch from your solution to the committed solution now, would be: #1087796: Allow altering of attachments in hook_mail_alter().
If you don't need to modify the attachments in some 'alter hook' you're fine for the moment.
(And you don't need to. If you needed to, you'd know.)
Comment #26
Brainwrap commentedGlad to hear it, thanks!
Comment #27
esbon commentedquicksketch thanks for all the work. Our sites would be useless without a way to send HTML emails
Comment #28
Saoirse1916 commentedDitto, I just applied the patch and it solved the problem on my end as well. Thanks!
Comment #29
virtuali1151 commented# 4 worked for me... should this be commited for future versions?
Comment #30
gregarios commentedWhen can we expect a new version with these "fixed" patches implemented? Has it been implemented in a -dev version already?
Comment #31
gr33nman commented#17 1162112-17.patch applied cleanly for me.
Thanks Roderik.
Comment #32
quicksketch"fixed" means it's been committed (as I said in #23). Yes it's already in dev releases. The fix will be in the 3.12 official version.
Comment #33
roderik@quicksketch: maybe the confusion in #30 is heightened because of the absence of 'dev releases on the project page'?
Is this a 'policy decision' on your part? Or some remnant of the Git migration? (Sorry I have no clue where to look up the answer to this possibly general question.)
Comment #34
HTF commentedsubscribing
Comment #35
hondaman900 commentedPatch in comment #17 makes no difference for me. I still get the
warning: Invalid argument supplied for foreach() in /home/....../modules/mimemail/mimemail.inc on line 359.error, with or without the file attachments checkbox checked.This is very disconcerting for my users, to get this error after submitting the form. Any solutions yet?
Thanks in advance.
Comment #36
virtuali1151 commented@hondaman900 - did you try the solution in #4... try switching the lines around as stated. This worked for me. Not sure why this isnt commited.
Cheers.
Comment #37
chrisla commentedPatch in #17 worked for me. Thanks roderik and quicksketch for your attention to this.
I'm using Mime Mail 6.x-1.0-alpha8 and was only experiencing the 'warning: Cannot use a scalar value as an array in /sites/all/modules/webform/includes/webform.submissions.inc on line 269' issue
Comment #38
giorgoskpatch from #17 worked for me
will this be included in 3.12 release ?
the way this issue is marked as fixed is a bit confusing
since there is no release (dev or minor release that includes this)
Comment #39
easp commentedsubscribing
Comment #40
lulyx commentedpatch #17 worked for me too. Thanks roderik! good job
Comment #41
breeze76 commentedOK.. I am getting this error and want to install the patch... I do not know how to do that... Could someone please direct me to the right place or explain how to do it...
Thanks...
Comment #42
giorgosk@breeze76
learn how to apply patches http://drupal.org/patch/apply
or apply by hand
#17 is a very simple patch
3 line deletions (-) and 2 line additions (+)
starting on line 266
on function webform_submission_send_mail
on file sites/all/modules/webform/includes/webform.submissions.inc
Comment #43
bbruda commentedmy warning
warning: Invalid argument supplied for foreach() in /sites/all/modules/mimemail/mimemail.inc on line 361.
patch #17 worked for me too. Thanks roderik!
Comment #44
breeze76 commentedJust an FYI... Patch #17 worked for me as well... Thanks to GiorgosK for explaining how the patch works, even though I read the link on patching... I still do not get how to use the git to patch.. guess it will take some time for me to get there..
Comment #45
leosuaar commentedThank you, #17 worked for me too, I am happy!
Comment #47
gorka commentedHi Hondaman900,
did you finally fix it? I'm getting the same error and I cannot get rid of it...
Mime Mail 6.x-1.x-dev (2011-Oct-15 )
Webform 6.x-3.14
Drupal core 6.22
PHP Version 5.3.3-7+squeeze1
MySQL 5.1.49
Regards,
Gorka