Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Select::statesHandler() expects the $select_states variable to be initialized, but that's not guaranteed to be the case. As it turns out, the variable ends up being assigned to the $states variable before being returned anyway. I've fixed the issue by renaming the $select_states variable to $states.
Comments
Comment #2
colanPatch no longer applies. Is this still a problem after upgrading to the latest dev (8.x-1.0-alpha3 with #2873350: Warning: Invalid argument supplied for foreach() in Drupal\conditional_fields\Plugin\conditional_fields\handler\Select->statesHandler)?
Comment #3
colanMarked #2925646: Undefined variable: select_states in Drupal\conditional_fields\Plugin\conditional_fields\handler\Select->statesHandler() and Invalid argument supplied for foreach() in Drupal\conditional_fields\Plugin\conditional_fields\handler\Select->statesHandler() as a duplicate of this issue.
Comment #4
Baysaa CreditAttribution: Baysaa as a volunteer commentedHere's a reroll against alpha4. I believe patch is still needed to prevent notices.
Comment #5
Baysaa CreditAttribution: Baysaa as a volunteer commentedComment #6
Baysaa CreditAttribution: Baysaa as a volunteer commentedI'll reroll against the dev version later.
Comment #7
hawkeye.twolfHere's the re-roll. Note that the previous re-roll missed a crucial change (deletion of the final variable assignment).
Comment #8
brad.bulger CreditAttribution: brad.bulger commentedCurrent code is still referencing
$select_states
when it shouldn't. The patch in 7 assigns to$states
which is not returned. It should just use$state
. Re-roll attached.Comment #9
dqdThanks for the report and all the efforts/work in here! +1
Is this fix still required and if, it surely needs a re-roll? Thoughts?