TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 187 of modules/contrib/config_split_ignore/src/Plugin/ConfigFilter/ConfigSplitIgnoreFilter.php

Created on 15 February 2024, about 1 year ago

Problem/Motivation

When you install the module, opening the /admin/config/development/configuration throws the following error:

TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 187 of modules/contrib/config_split_ignore/src/Plugin/ConfigFilter/ConfigSplitIgnoreFilter.php

Proposed resolution

Providing a patch to fix this issue - it checks if configuration is not empty before trying to search for it.

๐Ÿ› Bug report
Status

Active

Version

1.10

Component

Code

Created by

๐Ÿ‡ง๐Ÿ‡ฌBulgaria yivanov

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @yivanov
  • ๐Ÿ‡ง๐Ÿ‡ฌBulgaria yivanov
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chetan 11

    chetan 11 โ†’ made their first commit to this issueโ€™s fork.

  • Merge request !3fixed โ†’ (Open) created by chetan 11
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chetan 11

    Please check the above MR.

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cpierce42

    Merge request #4 fails when running `drush cim -y` patch fails to fix.

    example config file that fails:

    debug: false
    cron_interval: null
    cron_interval_override: null
    hide_signup_messages: 0
    third_party_settings: null

    Error stack:

    $ drush cim -y
     [warning] Undefined array key "ignored" ConfigSplitIgnoreFilter.php:186
     [warning] Undefined array key "ignored" ConfigSplitIgnoreFilter.php:172
     [error]  TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 172 of /app/docroot/modules/contrib/config_split_ignore/src/Plugin/ConfigFilter/ConfigSplitIgnoreFilter.php) #0 /app/docr
    oot/modules/contrib/config_split_ignore/src/Plugin/ConfigFilter/ConfigSplitIgnoreFilter.php(172): in_array('!acquia_connect...', NULL, true)
    #1 /app/docroot/modules/contrib/config_filter/src/Config/FilteredStorage.php(61): Drupal\config_split_ignore\Plugin\ConfigFilter\ConfigSplitIgnoreFilter->filterExists('acquia_connecto...', true)
    #2 /app/docroot/modules/contrib/config_filter/src/Config/FilteredStorage.php(182): Drupal\config_filter\Config\FilteredStorage->exists('acquia_connecto...')
    
  • First commit to issue fork.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ญ๐Ÿ‡บHungary boobaa

    Update MR helps getting rid of error messages. However, this does not make config_split_ignore working with config_ignore:3.2. ATM, I think the reason is that \Drupal\config_split_ignore\Plugin\ConfigFilter\ConfigSplitIgnoreFilter::create() is not even called with config_ignore:3.2 โ€“ and this might be exactly the same reason that was mentioned in #3413717-6: Error: Class "Drupal\config_ignore\Plugin\ConfigFilter\IgnoreFilter" not found โ†’ .

  • First commit to issue fork.
  • Merge request !5Skip if $this->active is empty. โ†’ (Closed) created by hktang
  • ๐Ÿ‡ฏ๐Ÿ‡ตJapan hktang

    In my case, I am performing an upgrade that disables this module at some point. I am still seeing and error that $this->active is null. I added a change to the MR (Skip if $this->active is null) that lets me continue the upgrade.

    With the added change, my upgrade /deployment passes. In summary, two patches are necessary:

    - Patch #3 from this issue: https://www.drupal.org/project/config_split_ignore/issues/3413717 ๐Ÿ› Error: Class "Drupal\config_ignore\Plugin\ConfigFilter\IgnoreFilter" not found Active
    - Latest !MR3 from this issue.

Production build 0.71.5 2024