TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given

Created on 24 July 2023, over 1 year ago
Updated 22 August 2023, about 1 year ago

Problem/Motivation

Can't visit /admin/modules page when this module is installed on a fresh drupal minimal profile install.
Receiving this error:

TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 48 of /var/www/html/web/modules/contrib/readmehelp/readmehelp.module).

Proposed resolution

While trying to enable a few custom modules that depended on this one with drush, I got this error in the terminal:

In Container.php line 157:
  You have requested a non-existent service "file.usage".

even if none of my configuration seemed to use core's file module.
So I tried adding file as a dependency on my module requiring readmehelp and reinstalling the site (still minimal profile) and the error is gone.
Probably file is a dependency of this module?

🐛 Bug report
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

🇮🇹Italy kopeboy Milan

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

Comments & Activities

  • Issue created by @kopeboy
  • First commit to issue fork.
  • @sakthi_dev opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sakthi_dev

    Please review.

  • Status changed to Postponed: needs info over 1 year ago
  • 🇪🇪Estonia drugan

    I am not able to reproduce it. Even if all Readmehelp modules are disabled on the /admin/config/system/readmehelp-settings page we get an empty array here:

    $readmehelp_modules = \Drupal::config('readmehelp.settings')
      ->get('readmehelp_modules');
    

    As for the second error you do not need to depend on the Readmehelp in your custom modules anymore. It scans all enabled modules and if some of them has no hook_help() implementation and has README.md in its directory then it will be rendered on a /admin/help/your_module page.

    You can manually disable / enable the Readmehelp support on the settings page above. If you are unsure which modules are eligible for this kind of support just reinstall the Readmehelp and it will discover that for you automatically.

    See more: 📌 Allow using the readmehelp for all modules with no module help. Fixed

  • 🇮🇳India mukhtarm

    Reviewed this issue and the error not present for me too after installing and taking the module page.
    D10.1.1, php 8.2

  • Status changed to Closed: works as designed about 1 year ago
Production build 0.71.5 2024