Commit b158ce36 authored by nedjo's avatar nedjo Committed by Nedjo Rogers
Browse files

Issue #2992575 by nedjo, mrgoodfellow, sjerdo: PHP 7.2 - Error occurring:...

Issue #2992575 by nedjo, mrgoodfellow, sjerdo: PHP 7.2 - Error occurring: Warning: count(): Parameter must be an array or an object that implements Countable in field_collection_field_widget_embed_validate()
parent 0ef162bb
......@@ -1532,7 +1532,8 @@ function field_collection_field_widget_embed_validate($element, &$form_state, $c
// Copied from _form_validate().
if (isset($elements['#needs_validation'])) {
$is_empty_multiple = (!count($elements['#value']));
$is_countable = is_array($elements['#value']) || $elements['#value'] instanceof Countable;
$is_empty_multiple = $is_countable && (!count($elements['#value']));
$is_empty_string = (is_string($elements['#value']) && drupal_strlen(trim($elements['#value'])) == 0);
$is_empty_value = ($elements['#value'] === 0);
$is_empty_option = (isset($elements['#options']['_none']) && $elements['#value'] == '_none');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment