Fatal PHP error after enabling the module

Created on 6 July 2023, 12 months ago
Updated 11 July 2023, 12 months ago

Problem/Motivation

When I install this module on a Drupal 9.5.9 site with PHP 8.1.20 and just enable the module, anonymous visitors will cause a fatal error.

TypeError: array_values(): Argument #1 ($array) must be of type array, null given in array_values() (line 39 of /sites/web/mywebsite/drupal/web/modules/contrib/reference_access/reference_access.module)

That is a pitty. This module offers exactly what I need...

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands ecvandenberg

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

Comments & Activities

  • Issue created by @ecvandenberg
  • Status changed to Needs review 12 months ago
  • πŸ‡ΏπŸ‡¦South Africa droces

    Thanks for logging this @ecvandenberg. It's been years since I last worked on this module, since my time is always super limited. But good to hear that it would be useful to you.

    I've just fixed this issue and made some other minor improvements. Can you try the latest dev version to see if it's fixed and works for you?

  • πŸ‡³πŸ‡±Netherlands ecvandenberg

    And thank you for a quick fix!
    It works in a fresh D10 website, but with some remarks.
    When you add or remove a node type at /admin/config/system/reference-access it immediately has effect to the user trying to get access. I simulate this by having a private browser window with the dedicated user logged in and trying to access the restricted node.
    But when you change the specific nodes the user should have access to, that does not has effect before clearing all cache.

    In an older D9.5.10 it works partly. Add or remove a node type at /admin/config/system/reference-access it immediately has effect.
    But adding a specific nodes to a user does not have any effect. The access stays forbidden.

    I do not see any errors in the CMS log. If you have any hints in how I could debug this better please let me know.
    This site used to have other access modules like access by term. But these are all uninstalled now.

Production build 0.69.0 2024