After upgrading from 6.2 to 6.3 (database update #6204) I get a list of these warnings:

warning: Cannot use a scalar value as an array in C:\Program Files\BitNami Drupal 6 Stack\apps\drupal\htdocs\includes\form.inc on line 1340.

On all my webforms with "datefields" I get this warning, and it looks like every field of the date (so: day, month and year) generates one warning.

Also the present civicrm value is not shown anymore.

Any help would be appreciated.

Comments

colemanw’s picture

Status: Active » Fixed

Well, heck. So much for a bug-free release.
Fix committed to -dev

diff --git a/webform_civicrm_utils.inc b/webform_civicrm_utils.inc
index d5bdef9..ed8164f 100644
--- a/webform_civicrm_utils.inc
+++ b/webform_civicrm_utils.inc
@@ -947,17 +947,18 @@ function webform_civicrm_fill_values(&$elements, $data, $f
            && isset($submitted[$element['#webform_component']['cid']]))) {
         $val = $data[$ent][$c][$table][$n][$name];
         if ($element['#type'] == 'date') {
-          $dates = explode('-', $val);
+          $date = strtotime($val);
           $val = array(
-            'year' => $dates[0],
-            'month' => intval($dates[1]),
-            'day' => intval($dates[2]),
+            'year' => (int) date('Y', $date),
+            'month' => (int) date('m', $date),
+            'day' => (int) date('d', $date),
           );
         }
         elseif (($element['#type'] == 'checkboxes' || !empty($element['#multipl
           $val = explode($sp, trim($val, $sp));
         }
-        if ($element['#type'] != 'checkboxes' && empty($element['#multiple']) &
+        if ($element['#type'] != 'checkboxes' && $element['#type'] != 'date'
+        && empty($element['#multiple']) && is_array($val)) {
           $val = array_pop($val);
         }
         if ($element['#type'] == 'hidden') {
BasH’s picture

Sorry for the bug (-:, next time I'll wait a while with upgrading...
Couldn't test this until this afternoon.
Applied the patch to the inc-file and it works again,
thanks (again) for the fast reaction and solution,
Bas

colemanw’s picture

Glad the fix works for you.
What would be much better than everyone waiting to upgrade would be if people helped to test the -dev before it's released. Then we could catch bugs before a release instead of after.

BasH’s picture

I agree, I am using/testing lots of dev versions and normally I install them as soon as possible. In this case however, I also have a session issue in this module, so I have to manually change every dev version ... not one of my favourite activities.
But I am glad if I can be of any help, especially because of your recent help to me, so I am going to install the dev version of this module on a testsite.

Status: Fixed » Closed (fixed)

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

colemanw’s picture

The session issue is now fixed as of 2.4.
Happy testing :)

petednz’s picture

should be able to upgrade when you let us have eileen back ;-)