Problem/Motivation

TypeError: Illegal offset type in Drupal\conditional_fields\Plugin\conditional_fields\handler\OptionsButtons->checkBoxesHandler() (line 168 of modules/composer/conditional_fields/src/Plugin/conditional_fields/handler/OptionsButtons.php).

Comments

maniesraj created an issue. See original summary.

maniesraj’s picture

StatusFileSize
new301.01 KB

Proposed resolution

          if(!is_array($options['values'])){
            $checkboxes_selectors[conditional_fields_field_selector($field[$options['values']])] = ['checked' => TRUE];            
          }
maniesraj’s picture

Here is the patch!

benstallings’s picture

Status: Needs review » Needs work

Claude Code says:

This is a band-aid that silently swallows the real problem.

The else branch at line 167-168 is the fallback when $values_array is empty — it tries to use $options['values'] as a single key to look up a checkbox. If $options['values'] is an array here, it means the data is in an unexpected format. Wrapping it in if (!is_array(...)) just silently skips it, producing no state at all — the dependency would be ignored with no warning.

The better fix would be to understand why $options['values'] is sometimes an array in the AND case when $values_array is empty, and handle it properly (e.g. iterate over it the same way the if branch does). Also a minor style issue: missing space after if.

Verdict: Not merge-worthy. It masks a data handling bug rather than fixing it. The dependency would silently stop working for affected configurations.