TypeError: Drupal\rest_export_nested\Plugin\views\display\RestExportNested::flatten(): Argument #1 ($data) must be of type array, null given

Created on 24 June 2024, 5 months ago
Updated 2 August 2024, 4 months ago

Problem/Motivation

Some of our views are throwing the following error message,

TypeError: Drupal\rest_export_nested\Plugin\views\display\RestExportNested::flatten(): Argument #1 ($data) must be of type array, null given, called in /usr/share/nginx/html/project-consumer-drupal/modules/contrib/rest_export_nested/src/Plugin/views/display/RestExportNested.php on line 45 in Drupal\rest_export_nested\Plugin\views\display\RestExportNested->flatten() (line 92 of /usr/share/nginx/html/project-consumer-drupal/modules/contrib/rest_export_nested/src/Plugin/views/display/RestExportNested.php).

Steps to reproduce

Proposed resolution

     if (gettype($results) === 'object') {
       // @todo Allow rows name property to be customizable.
       $rows = 'rows';
-      $results->$rows = $this->flatten($results->$rows);
+      $results->$rows = is_array($results->$rows) ? $this->flatten($results->$rows) : [];
     }
     else {
-      $results = $this->flatten($results);
+      $results = is_array($results) ? $this->flatten($results) : [];
     }

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Sivaji_Ganesh_Jojodae Chennai

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024