I ran across a very quirky issue in the 7.x-4.0-rc regarding field keys on webform fields.

It appears as if an extra-long field key results in no warnings or errors on the administrative side. However, when a user submits the webform, the fields with the extra long field keys do not save. When the fields are examined on the Webform admin UI for the form, the fields are blank in the submissions.

I was able to test this with two Select Options fields, both of which had keys generated from their long titles:

  • If yes, approximately how many total hours have you volunteered in that time period?
  • Would you be interested in a CoE Cares program that tracked volunteer hours?

Once I went in to the webform administrative interface and truncated the field keys, new submissions would properly save the submission data for those fields.

I can provide more information or more examples if needed.

Comments

DanChadwick’s picture

Priority: Normal » Major

Bumping to major since this involves data loss.

DanChadwick’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

I cannot reproduce this. I created both text and select fields using the keys you generated. The maximum form key length is 128, both in the database and in the component definition form. Anything longer than this is not accepted.

I tested using Firefox on Windows. It is possible that some browsers on some platforms have some shorter limit?

Webbeh’s picture

I'd be happy to check this in other browsers. Let me do a little testing on my end today, and I'll report back.

Webbeh’s picture

I've been able to reproduce it with the following title/key:

  • Title: Fellowship Award Winners may bring one guest. Will you be bringing a guest? (limit one)
  • Key: fellowship_award_winners_may_bring_one_guest_will_you_be_bringing_a_guest_limit_one

The key is only 83 characters long, yet it is refusing to save the value, which is just a select options using Y|Yes, N|No. Changing it to 1|Yes, 0|No has no effect.

You can view the form here: http://forms.coe.gatech.edu/content/huge-form

As you can see, it happens for date, textarea, textfield, and select. Drupal (or the error logs) aren't giving me much information on what might be going on.

Still working with Webform-4.0-rc4, curious to see if rc5 would fix it.

Note that the #4 case ("Fellowship Award Winners may bring one guest. Will you be bringing a guest? [limit one] 4 ") works fine (saves the value), as the key is dramatically shortened from 84 characters.

Shows up in Chrome, Firefox, Safari on Mac.

Webbeh’s picture

Status: Postponed (maintainer needs more info) » Active
DanChadwick’s picture

Was this database upgrade from a prior version? If so, can you reproduce it with a fresh installation?

Also, what is the length of the form key field in the webform submission data table in your installation?

Webbeh’s picture

I can't say for certain whether this was a move from 3.x to 4.x or whether it was 4.x from scratch. I can, however, reproduce it both ways (3.x to 4.x, and 4.x from scratch) and see if I can recreate it.

The only fields in _webform_submitted_data are:

nid - int(10) unsigned
sid - int(10) unsigned
cid - smallint(5) unsigned
no varchar(128)
data mediumtext

DanChadwick’s picture

The only fields in _webform_submitted_data are:

My error. What's the schema for form_key in webform_component?

Webbeh’s picture

varchar(128) and it's showing the correct full key.

DanChadwick’s picture

Version: 7.x-4.0-rc4 » 7.x-4.x-dev
Status: Active » Postponed (maintainer needs more info)

Please retest with the lastest 7.x-4.x-dev. I could not reproduce your problem with "Fellowship Award Winners may bring one guest. Will you be bringing a guest? (limit one) 2"

Webbeh’s picture

Thanks Dan for checking into this. I can't seem to recreate it either, which lends itself to likely a weird bug with my module choices rather than an issue in the latest rc of 4.x.

DanChadwick’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Please reopen if you can reproduce this with a clean install.

hansrossel’s picture

Version: 7.x-4.x-dev » 7.x-4.2
Priority: Normal » Critical
Status: Closed (cannot reproduce) » Active
Issue tags: +php 5.4 issues

I have now reproduced this on a fresh install and found out it is a php 5.4 issue that occurs when the key is bigger than 64.

Using php 5.4.35

  • Install Drupal 7.34 and Webform 4.2
  • Create a text field 60000000000000000000000000000000000000000000000000000000000012345 (with 65 characters)
  • Create a text field 6000000000000000000000000000000000000000000000000000000000001234 (with 64 characters)

The 64 character field submits its values correctly.
The 65 character field does not give any error when submitting but does not save any values.
When the 65 character field is required it gives a validation error as if it is empty.

Exactly the same installation on php 5.3.28 does not have any problems.

Setting this to critical as there is data loss. It is especially dangerous as this happens also if you have tested the forms while the installation was on php 5.3 and then upgrade to php 5.4 and will normally not retest all forms, but will silently lose a lot of data.

DanChadwick’s picture

Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

Changing back to normal since existing data is not lost and this affects a tiny subset of installation.

I believe you are talking about long form_key values for components. Are these nested within a fieldset?

The schema calls for varchar(128). Can you confirm that this is what your table has? I cannot see anything in PHP 5.4 that would cause this: http://php.net/manual/en/migration53.incompatible.php

I suspect that the difference might be the database or database version, or database engine. What is the character set and collation of the webform tables in both the database that works and the one that doesn't?

hansrossel’s picture

I reverted the installation to php 5.3 at the moment, will try to research more in depth after the holidays, thanks for the advice!

DanChadwick’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Closed for lack of activity.

YesCT’s picture

Issue tags: -php 5.4 issues +PHP 5.4

using the more common tag (so I can delete the less commonly used one)

liquidcms’s picture

Title: Field Key length causing Field Submissions to not save » Field Key length causing Field Submissions to not save with PHP 5.4
Status: Closed (cannot reproduce) » Active

i just came across this issue as well.

my form used to work until i moved the site to a different server; then 2 of my webform fields were no longer being submitted. since these are both mandatory fields; the issue was noticed right away since the form can no longer be submitted.

i tried a couple things like re-adding the field and nothing helped. then i noticed the key name (i didnt set this up originally or wouldnt have used key names this long). i shortened the names and the form is now fine again.

not sure what all is different in new server but majority of things are unchanged. major versions of php, mysql and apache are the same; drupal code/config are exactly the same.

oops, nope, my bad.. php version upgraded from 5.3.29 to 5.4.38 - also just noticed i was on old version of webform (3.18); but i just upgraded to 3.22 and problem is still there.

DanChadwick’s picture

@liquidcms

What is the form key that causes the issue?
How short do you need to make it in order for it to work?
What database, database engine, and version are you using?
What is the character set of the webforms_submission_data table in the database?
What version (specifically) of PHP are you using?
Are there any messages given to the user or in any of the logs?
Does the form save correctly, except for the component with the long key?

liquidcms’s picture

some of these are answered above; but i'll compile them all here. and to be clear, even though i suggested (and changed title) to point to issue as php 5.4; in fact the issue may simply be a setting in php.ini as this of course may also have changed with server change (odd though that other have stated broken with 5.4 and fixed upon return to 5.3).

What is the form key that causes the issue?
'do_you_feel_this_property_can_be_staged_using_only_the_clients_furnishings_and_accessories'
How short do you need to make it in order for it to work?
- didn't fully test; but 70 is too long; 60 is ok.
What database, database engine, and version are you using?
- mysql 5.6.23
What is the character set of the webforms_submission_data table in the database?
utf8 general ci
What version (specifically) of PHP are you using?
5.4.38
Are there any messages given to the user or in any of the logs?
none
Does the form save correctly, except for the component with the long key?
field is set as mandatory; so nothing gets saved. if i unset mandatory form submits and all fields are saved to db except the one in question.

DanChadwick’s picture

What is the length of the form_key field in the webform_components table? It should be 128.

I tried this with a 128-character key and PHP 5.5 and it worked fine.

Are you using a hardened PHP, such as:
http://suhosin.org/stories/index.html#suhosin.post.max_name_length

DanChadwick’s picture

Status: Active » Closed (cannot reproduce)
Issue tags: -PHP 5.4

Please re-open if you still have an issue and an reproduce this on plain PHP. I suspect #21 is the issue.

liquidcms’s picture

not sure what a "plain php" is. i am using the default dedicated server lamp install from one of the largest hosting firms in the US. It uses the latest version of cpanel to manage/install php. it's pretty "plain".

i'll do a bit more digging; but to be honest, i am not too concerned about the issue. i don't use webform much and i can tell my clients to simply use shorter keys.

liquidcms’s picture

lol.. well, didn't take much digging to find:

i do have suhosin with default settings:
suhosin.cookie.max_name_length 64

mystery solved.

DanChadwick’s picture

Category: Bug report » Support request
Status: Closed (cannot reproduce) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

geforcegtx480’s picture

thanks for all your help!
I had a similar issue after moving all our 400 sites to a new server.
php version: 5.615
suhosin version: 0.9.38
OS: centos

Looking through our message logs we saw that get post data was being dropped because the index length was too long.
Hence form data for long form keys was not being saved to the database.

What solved mine was setting the following variable in suhosin to 128:
max_array_index_length
post.max_array_index_length
get.max_array_index_length
request.max_array_index_length

Thanks again.