I have a multi-page webform. I get the above error when I "Save Draft" on Page 1.
Along with the above error, I also get the below error:
warning: mysql_real_escape_string() expects parameter 1 to be string, array given in public_html/test/includes/database.mysql.inc on line 321.
It looks like multi-select fields (i.e. more than one checkbox can be checked) are causing the problem. I am saying that because the error goes away if I remove the only multi-select field on page 1. Also, the error-pair (the two errors above) appears as many times as there are multi-select fields on page 1. For example, I moved a multi-select field from page 2 to page 1 so page 1 now has two multi-select fields. When I "Save Draft" on page 1 with two multi-select fields now, the error pair appears twice.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | 0001-fixed-issue-1167286.patch | 1.06 KB | toabi |
| #9 | webform_select_or_other_fixes-d6.patch | 3.58 KB | quicksketch |
| #9 | webform_select_or_other_fixes-d7.patch | 3.58 KB | quicksketch |
| Multi-Select field configuration.png | 73.6 KB | kamgd | |
| Page 1 Webform Configuration.png | 39.23 KB | kamgd |
Comments
Comment #1
kamgd commentedComment #2
kamgd commentedI have more to add based on further testing. I suspect this could be an issue with the "Select (or other)" module based on my observations below, so I have posted this as an issue there as well.
The error-pair (the two errors above) goes away if I don't set the field for the "Other" option (i.e) uncheck Allow "Other..." option for the field. Also, the error-pair (the two errors above) appears as many times as there are multi-select fields that have Allow "Other..." option checked on page 1. For example, if there are two such fields on page 1, I get the following errors when I "Save Draft".
warning: Illegal offset type in isset or empty in /home/YYYYY/public_html/test/sites/all/modules/webform/components/select.inc on line 480.
warning: Illegal offset type in isset or empty in /home/YYYYY/public_html/test/sites/all/modules/webform/components/select.inc on line 480.
warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /home/YYYYY/public_html/test/includes/database.mysql.inc on line 321.
warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /home/YYYYY/public_html/test/includes/database.mysql.inc on line 321.
I don't face this problem with submitting a single page Webform. I face it only when I "Save Draft" on Page 1 in a multi-page form.
I initially thought that is an issue with the "Webform" module but I now think it is a problem with the the "Select (or other)" given my observations above.
Thanks in advance for any help!
Comment #3
kamgd commentedI just got a response from "Select(or other)" module maintainer that the problem is happening in a particular use case for webform- http://drupal.org/node/976260
I am wondering if someone can help me with this issue here.
Thanks in advance for any help!
Comment #4
dgastudio commentedsame problem, for now solved removing
&& isset($options[$option_value])from select.inc
Comment #5
kamgd commentedThanks for providing this fix. I tested this but I encounter the following error when I click "Save Draft" on Page 1.
warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /home/YYYYY/public_html/includes/database.mysql.inc on line 321.
I get as many of these errors as there are "multi-select" questions on the page.
I don't get this error when I click "Next Page" but only when I click "Save Draft".
Appreciate any help you or the community may be able to provide!
Comment #6
quicksketchThanks for the reports guys, I've confirmed this issue in the latest version of Webform. I've updated the title of the issue to reflect when the problem occurs more accurately.
Comment #7
dgastudio commentedso, any update on this?
Comment #8
quicksketchNo.
Comment #9
quicksketchThis patch fixes several problems with select or other:
- Values are maintained when going "Back" and "Next" on a submission when the page contains a Select or Other field.
- The Back button allows going backward when a Select or Other field is on the current page.
- The "Save Draft" functionality works when a Select or Other field is on the current page.
Considering the number of fixes and no apparent downside, I've committed these patches to the 3.x branches.
Comment #10
dgastudio commentedi can't apply the d6 version patch to version 3.9!
as i can see, this patch is for 3.dev version!
Comment #11
quicksketchI wouldn't expect you would be able to be able to apply the patch directly, as I've gone through over 50 patches in the last 2 weeks. You should try downloading the development version after 24 hours or doing a checkout from Git. I plan on releasing 3.10 on Wednesday, May 18th, but I'd definitely appreciate it if you could check out the latest code and post any troubles you have (hopefully as new issues or corresponding to the appropriate one).
Comment #12
dgastudio commentedok, thank u very much!
Comment #13
markabur commentedIn the Drupal 7 version of Select or Other, the function is select_or_other_element_process(), not select_or_other_process() -- see #1167286: Fatal error: Call to undefined function select_or_other_process() in (...)/includes/form.inc on line 1723
Comment #14
quicksketchThanks markabur. Indeed I didn't check select_or_other in Drupal 7 at the time because it doesn't yet have any usable version as far as I know.
Comment #15
Jerome F commentedissue pointed in #13 fixed in webform's last git
Comment #16
toabi commentedThese changes still break the D7 version of select_or_other here: #1167286: Fatal error: Call to undefined function select_or_other_process() in (...)/includes/form.inc on line 1723
Although Jerome F. wrote there, that this is fixed in last webform git, it is not: http://drupalcode.org/project/webform.git/blob/HEAD:/components/select.i...
The attached patch should resolve the issue.
Comment #17
enap commentedConfirming #16 fixes the issue using D7.2, Webform 3.11 & Select or Other 2.0 (as per error in #13).
Comment #18
Jerome F commentedMy mistake, I used the git version 7.x-3.9-hotfix for my comment in #15 and your patch is against master.
The patch fixes the issue, thank you.
this patch is not commited to D7 yet, so I change the status accordingly
http://drupal.org/node/156119 :
Patch (to be ported)
The patch has been successfully committed to a branch of the project, and still needs to be committed to another, but the current patch doesn't apply to the target branch and needs to be modified in order to do so.
Comment #19
quicksketchThanks guys, I'll get this in next time I'm working on Webform.
Comment #20
webankit commented+1
Comment #21
nardberjean commentedI understand it may be fixed in webform 7.x-3.12, good to know.
Comment #22
quicksketchCommitted patch from #16. Thanks toabi and all the testers!
Comment #24
siliconmind commentedThis issue is marked as fixed, but I'm experiencing similar problem with "Illegal offset type" error. I'm using webform 6.x-3.9 and select_or_other 6.x-2.9 which are the latest.
I'm getting Warning: Illegal offset type in isset or empty in select.inc on line 510.
The variable $option_value in _webform_submit_select is sometimes an array and that causes error on line 510.
Comment #25
markabur commented@SiliconMind the latest version of Webform is actually 6.x-3.14 -- you're right that 6.x-3.9 doesn't contain the fix.
Comment #26
siliconmind commented@markabur, I made a mistake writing down webform version. Actually I'm using 3.14 and am still getting this error.
Aside from error on line 510 of select.inc, when I click "< Previous Page" the values from previous selection are not checked by default, but instead "Other" field is active and all values, comma separated, are put there.
Comment #27
markabur commentedSorry, sounds like you're having a totally different problem than the one in the original post -- please open a separate issue for it so that it can be fixed separately (even if it was related to this issue, at this point a separate followup issue would be better anyway).
Comment #28
siliconmind commentedFor reference: #1337514: Illegal offset type in isset or empty in select.inc when using Select or Other on multipage forms