TypeError: array_keys() expects parameter 1 to be array, null given

Created on 12 March 2024, 9 months ago
Updated 14 March 2024, 9 months ago

Problem/Motivation

When attempting to access the 'People' or 'Configuration' pages in the admin panel, as well as pages created via the DXPR Builder, an error occurs stating The website encountered an unexpected error. Please try again later.Log message error states "TypeError: array_keys(): Argument #1 ($array) must be of type array, null given". This error is preventing access to crucial administrative functionalities and the viewing of content created with the DXPR Builder.

Steps to reproduce

1. Navigate to 'admin/config'.
2. Navigate to 'admin/people'.
3. Attempt to view any page created with the DXPR Builder.
4. Observe the TypeError on these pages.

Proposed resolution

I am requesting assistance to resolve the TypeError issue. This may involve reviewing the 'DxprBuilderLicenseService.php' code to ensure `array_keys()` is provided with a valid array and investigating why DXPR Builder-created pages are also affected.

Remaining tasks

- Investigate and diagnose the cause of the `null` value being passed to `array_keys()`.
- Identify why pages created by DXPR Builder are not accessible.
- Correct the underlying issue(s) to restore access to the affected areas of the site.

User interface changes

The error prevents the 'People' and 'Configuration' pages and DXPR Builder-created pages from rendering properly.

API changes

None identified; input from the maintainers is required.

Data model changes

None identified; input from the maintainers is required.

🐛 Bug report
Status

Closed: outdated

Version

2.2

Component

Code

Created by

🇲🇾Malaysia kimberly_thl

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

Comments & Activities

  • Issue created by @kimberly_thl
  • Assigned to abhishek_virasat
  • 🇮🇳India dineshkumarbollu

    @kimberly_thl try this will fix the error, but need to handle else.

    public function getUsersCount($before_id = NULL) {
        $users = $this->getLicenseUsers();
        if ($users !== NULL) {
            return count(array_keys($users));
        }
    }
  • 🇲🇾Malaysia kimberly_thl

    hello, thak you @dineshkumarbollu for your reply. i do already have this line of code in my DxprBuilderLicenseService.php file before this from 509 to 512. could this me other problems? The DxprBuilderLicenseService file is attached.

  • Issue was unassigned.
  • Status changed to Needs review 9 months ago
  • 🇮🇳India abhishek_virasat

    @kimberly_thl , I have fixed the issue and please review the patch

  • 🇲🇾Malaysia kimberly_thl

    hi abhishek_gupta1, thank you for your feedback. This patch still didnt work, I was wondering could this be the problem with shared hosting server updating their system?

  • Status changed to Closed: outdated 9 months ago
  • 🇳🇱Netherlands jurriaanroelofs

    Thank you for your input. However, this bug is not reproducible in version 2.6.0, therefore, we do not require any code changes to address this particular issue.

    Anyone experiencing the same error should update to the latest release.

Production build 0.71.5 2024