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.
When we start from a dump from a staging/development site, we sometimes get the following error:
in_array() expects parameter 2 to be array, null given in /environment_indicator/environment_indicator.module on line 314
This is fixable by just submitting the config form again, and probably more related to something in our workflow then our module, but wouldn't hurt to add a check in the code for null.
Comment | File | Size | Author |
---|---|---|---|
#5 | 3020895-environment-inarray-null-5.patch | 855 bytes | cobenash |
#2 | environment_indicator-in_array_null-3020895-2-D8.patch | 917 bytes | brentg |
Comments
Comment #2
brentgComment #3
brentgComment #4
leopaccanaro CreditAttribution: leopaccanaro at CI&T commentedHi @brentgees
Wouldn't it make more sense to use is_array() instead of empty() to check if \Drupal::config('environment_indicator.settings')->get('toolbar_integration')) returns an array?
Comment #5
cobenashI agree with @leopaccanaro.
Modify with a new one.
Comment #6
StefanieV CreditAttribution: StefanieV commentedPatch #5 works for me. Thanks!
Comment #7
pratik_kambleComment #8
pratik_kambleThanks @cobenash and @brentgees for the patch.
Checked patch in comment #5, adding check in the code for NULL makes sense. I have tried patch locally, by deleting the config from the database and then checking the issue. No error/warning occurs. Patch LGTM.
Comment #10
pratik_kambleComment #11
pratik_kamble