summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurence Liss2012-08-17 19:51:15 (GMT)
committerLaurence Liss2012-08-17 19:51:15 (GMT)
commita0c393c3aee77512186a673fa3015e7199949ad8 (patch)
tree5a13914c66fc22eba1b758a17fa547a61b05048a
parent16f1f2940bec86a0353255cdb0364ba70ac9ab5b (diff)
Need to ensure we're not getting null values as cid. is_int evaluates null as an integer -- thanks php typecasting -- so we need to be explicit. Also make variable names more logical.
-rw-r--r--webform_entity.module10
1 files changed, 5 insertions, 5 deletions
diff --git a/webform_entity.module b/webform_entity.module
index 31074ad..317546c 100644
--- a/webform_entity.module
+++ b/webform_entity.module
@@ -572,15 +572,15 @@ function webform_entity_webform_submission_submit(&$form, &$form_state) {
if (count($form_state['values']['submitted'])) {
foreach ($form_state['values']['submitted'] as $key => $value) {
$cid = webform_get_cid($form['#node'], $key, 0);
- if (!is_int($cid)) {
+ if (!is_int($cid) && !is_null($cid)) {
// If we are changing steps on a multistep webform (not saving), remove
// our custom entity fields from form_state['values'] to prevent webform
// from choking on them
// Leave 'hidden' elements to ensure we end up with something in webform_submitted_data
- $is_edit_draft = strpos($form_state['clicked_button']['#id'], 'edit-draft') !== 0;
- $is_edit_submit = strpos($form_state['clicked_button']['#id'], 'edit-submit') !== 0;
- $is_hidden = strpos($cid, 'hidden') !== 0;
- if (($is_edit_draft && $is_edit_submit) || $is_hidden) {
+ $edit_draft = strpos($form_state['clicked_button']['#id'], 'edit-draft') === 0;
+ $edit_submit = strpos($form_state['clicked_button']['#id'], 'edit-submit') === 0;
+ $hidden = strpos($cid, 'hidden') === 0;
+ if (!($edit_draft || $edit_submit) || !$hidden) {
unset($form_state['values']['submitted'][$key]);
}
}