Problem/Motivation

When rendering a Canvas page while the Varbase dashboards module is enabled, the following error appears on the page:

An unexpected error has occurred while fetching components.
Error 500: array_key_exists(): Argument #2 ($array) must be of type array, null given
file: /var/www/html/docroot/modules/contrib/varbase_dashboards/src/Plugin/Block/VarbaseContentOverview.php

As a result, Canvas pages fail to render properly, producing a PHP warning and a 500 error.

Steps to reproduce

  1. Enable Varbase Dashboards & Canvas.
  2. Visit the main /canvas/**.
  3. Observe the PHP error in the components side or in the console.

Proposed resolution

Add a type check to ensure all variables are an array before calling array_key_exists().

Remaining tasks

  • ✅ File an issue about this project
  • ✅ Addition/Change/Update/Fix to this project
  • ✅ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Developer Documentation support on feature change/addition
  • ➖ User Guide Documentation support on feature change/addition
  • ➖ UX/UI designer responsibilities
  • ➖ Accessibility and Readability
  • ✅ Code review from 1 Varbase core team member
  • ✅ Full testing and approval
  • ✅ Credit contributors
  • ✅ Review with the product owner
  • ✅ Update Release Notes and Update Helper on new feature change/addition
  • ✅ Release varbase-10.1.0-beta1, varbase_dashboards-2.0.0-beta1

Varbase update type

  • ✅ No Update
  • ➖ Optional Update
  • ➖ Forced Update
  • ➖ Forced Update if Unchanged

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • [#3550904] fix: Prevent array_key_exists(): Argument #2 ($array) must be of type array, null given Error in Varbase Dashboards Block By: n.ghunaim
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

n.ghunaim created an issue. See original summary.

n.ghunaim’s picture

Status: Active » Needs review
rajab natshah’s picture

Title: PHP error: “array_key_exists(): Argument #2 ($array) must be of type array, null given” » Prevent array_key_exists(): Argument #2 ($array) must be of type array, null given Error in Varbase Dashboards Block

rajab natshah’s picture

Assigned: Unassigned » s.halawani
Issue summary: View changes
Issue tags: +varbase-10.1.0-beta1, +varbase_dashboards-2.0.0-beta1
rajab natshah’s picture

Assigned: s.halawani » Unassigned
Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.