After install module null array in the settings form

Created on 13 April 2023, over 1 year ago
Updated 5 March 2024, 10 months ago

When module installed. In the page /admin/config/content/nodeviewcount
has the errors:
TypeError: Drupal\nodeviewcount\Form\NodeViewCountSettingsForm::getRoleNamesOptions(): Argument #1 ($excluded_user_roles) must be of type array, null given, called in /var/www/html/web/modules/contrib/nodeviewcount/src/Form/NodeViewCountSettingsForm.php on line 123 in Drupal\nodeviewcount\Form\NodeViewCountSettingsForm->getRoleNamesOptions() (line 206 of modules/contrib/nodeviewcount/src/Form/NodeViewCountSettingsForm.php). .

🐛 Bug report
Status

RTBC

Component

Code

Created by

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

Comments & Activities

  • Issue created by @nblack69
  • 🇮🇳India siddharthjain

    I am not able to reproduce this issue.

  • I have drupal 9.5.3 and php 8.1.16
    I get this :

     The website encountered an unexpected error. Please try again later.
    TypeError: Drupal\nodeviewcount\Form\NodeViewCountSettingsForm::getRoleNamesOptions(): Argument #1 ($excluded_user_roles) must be of type array, null given, called in /var/www/html/web/modules/contrib/nodeviewcount/src/Form/NodeViewCountSettingsForm.php on line 123 in Drupal\nodeviewcount\Form\NodeViewCountSettingsForm->getRoleNamesOptions() (line 206 of modules/contrib/nodeviewcount/src/Form/NodeViewCountSettingsForm.php). 

    when i go to /admin/config/content/nodeviewcount

  • I get when I access "admin/config/content/nodeviewcount"
    Drupal 9.5.3
    Php 8.1.16

  • Don't understand.. can't make it work.
    I have drupal 9.5.3
    and php 8.1.16

  • I cannot make it work.. I don't know

  • Don't understands... maybe because of Drupal or php?
    Drupal 9.5.3 and php 8.1.16

  • maybe because of the drupal / php versions ?

  • 🇮🇳India shashank5563 New Delhi

    I am able to reproduce the issue.

    Message TypeError: Drupal\nodeviewcount\Form\NodeViewCountSettingsForm::getRoleNamesOptions(): Argument #1 ($excluded_user_roles) must be of type array, null given, called in /modules/contrib/nodeviewcount/src/Form/NodeViewCountSettingsForm.php on line 123 in Drupal\nodeviewcount\Form\NodeViewCountSettingsForm->getRoleNamesOptions() (line 206 of /modules/contrib/nodeviewcount/src/Form/NodeViewCountSettingsForm.php)

    I am using following PHP,Drupal and db

    Step to reproduce issue:
    1. Following Configuration needed.
    Drupal Version: 9.5.0
    PHP Version: 8.1.9
    Database Version: 10.8.3-MariaDB

    2. I have install the module
    3. Then try to access following URL: admin/config/content/nodeviewcount
    4. Getting the issue.

  • 🇮🇳India shashank5563 New Delhi

    I have made some changes in code. after fixing the code it is working fine.

  • Status changed to Needs review over 1 year ago
  • 🇷🇺Russia adci_contributor

    Thank you for your help!

    I was unable to repeat this problem with Drupal 9.5.11 and PHP 8.1.18. But everyone who has encountered the issue can try flush caches, uninstall and install the module again. If that doesn't help, this patch will be a good solution.

  • 🇺🇦Ukraine Kostiantyn

    On Drupal version: 10.2.3, MariaDB version: 10.4, and PHP version: 8.1, everything is working fine. I was able to reproduce the error on Drupal version 9.5.0, but the patch from @shashank5563 successfully resolves it.

  • Status changed to RTBC 10 months ago
  • 🇺🇦Ukraine Kostiantyn

    I tested the patch from @shashank5563 on Drupal 9.5.11. The error has disappeared.

Production build 0.71.5 2024