PHP warning when settings doesn't exist

Created on 20 July 2023, over 1 year ago
Updated 24 July 2023, over 1 year ago

Problem/Motivation

If entity_reports.settings doesn't exist, entity reports pages are displaying some PHP warning:

  1. Warning: foreach() argument must be of type array|object, null given in Drupal\entity_reports\Form\EntityReportsSettingsForm->buildForm() (line 123 of modules/contrib/entity_reports/src/Form/EntityReportsSettingsForm.php).
  2. Warning: foreach() argument must be of type array|object, null given in Drupal\entity_reports\Controller\EntityReportsController->__construct() (line 81 of modules/contrib/entity_reports/src/Controller/EntityReportsController.php).

Steps to reproduce

Logged as administrative user, you should:

  • Warning 1: go to /admin/config/development/entity-reports page
  • Warning 2: go to /admin/reports/entity page

Proposed resolution

Validate if entity reports fields exists before using it.

Remaining tasks

None

User interface changes

N/A

API changes

N/A

Data model changes

N/A

🐛 Bug report
Status

Closed: cannot reproduce

Version

2.0

Component

Code

Created by

🇧🇷Brazil brunapimenta

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

Comments & Activities

Production build 0.71.5 2024