- Issue created by @majdi
- Assigned to majdi
- Merge request !6Prevent PHP Warnings by Ensuring Node Bundle Existence Before Iteration. → (Open) created by majdi
- Status changed to Needs review
4 months ago 12:55pm 15 July 2024
When installing the BEE module in a Drupal instance without any defined node types, the system throws multiple PHP warnings related to undefined array keys and invalid arguments for foreach. This issue occurs because the module assumes the presence of node types without checking if they exist.
Warning: Undefined array key “node” in Drupal\bee\BeePermissions->permissions() (line 62 of modules/contrib/bee/src/BeePermissions.php).
Warning: foreach() argument must be of type array|object, null given in Drupal\bee\BeePermissions->permissions() (line 62 of modules/contrib/bee/src/BeePermissions.php).
These warnings repeat multiple times and are triggered during the permissions setup by the module.
Implement a conditional check within the permissions() method to verify the presence of node types before processing them. This will prevent the system from attempting to process an undefined or null data structure.
Needs review
3.0
Code