Greetings. By using the module I realize that this returns a warning of an array is not passed correctly to a php function (array_filter).

This code is as follows.

foreach ($items as $key => $val) (

          if ($val && (count (array_filter ($val)) < $min_selections)) (
            $Errors [$key] = t ('Please select at least options for% num% item', array ('%num' => $min_selections, '%item' => $components[$key]['name'] ));
          )
        )

As you can see the variable $ val is not an array. The array is the variable $ items. The above code is around line 211 of file webform_validation.validators.inc.

Suggest that the argument of the function array_filter is modified $val variable by the variable $items

Sorry by my english, I am from Venezuela and my english is not very good.

Bye.

Comments

quicksketch’s picture

Project: Webform » Webform Validation
Version: 6.x-3.x-dev » 6.x-1.1

This bug is in Webform Validation module, not Webform core.

svendecabooter’s picture

Assigned: Unassigned » svendecabooter
Status: Active » Postponed (maintainer needs more info)

Can you give more information on the specifics of your setup?
Did you change anything in the code, or did you implement any webform_validation hook?

By default, the minimum selection validation rule only applies to 'select' form components.
When the validation is run, $key is the component ID, and $val is an error of submitted entries for your 'select' form component.
Since each 'select' form component needs at least one option set, this will always be an array. I cannot reproduce your case where it isn't an array.

As an extra check i'm changing
if ($val && (count(array_filter($val)) < $min_selections)) {
to if (is_array($val) && (count(array_filter($val)) < $min_selections)) {.

Can you get the latest version of the module from CVS with this change, and see if that fixes your problem?

svendecabooter’s picture

Assigned: svendecabooter » Unassigned
svendecabooter’s picture

Status: Postponed (maintainer needs more info) » Fixed

Marking as fixed. Please reopen this ticket if the latest code changes didn't fix this problem.

Status: Fixed » Closed (fixed)

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