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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

brentgees created an issue. See original summary.

brentg’s picture

brentg’s picture

Status: Active » Needs review
leopaccanaro’s picture

Hi @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?

cobenash’s picture

I agree with @leopaccanaro.

Modify with a new one.

StefanieV’s picture

Patch #5 works for me. Thanks!

pratik_kamble’s picture

Assigned: Unassigned » pratik_kamble
pratik_kamble’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @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.

pratik_kamble’s picture

Status: Reviewed & tested by the community » Fixed
pratik_kamble’s picture

Assigned: pratik_kamble » Unassigned

Status: Fixed » Closed (fixed)

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