Undefined array key "column_relations"

Created on 30 May 2023, over 1 year ago
Updated 26 February 2024, 10 months ago

Problem/Motivation

Because of the way Drupal imports config, when importing the generated config from installing on a separate module the following default config key/value is added:

  _core:
    default_config_hash: <random-string>

This creates several php warnings as the expected array keys and object properties do not exist.

Steps to reproduce

  • Enable view_custom_table module
  • Create required view custom tables config via UI
  • Export generated config
  • Add exported config to a separate module's config/install directory
  • Delete config from site
  • Enable separate module (via UI or Drush)

The following php warnings will appear:

 [warning] Undefined array key "column_relations" view_custom_table.module:69
 [warning] Undefined array key "table_database" view_custom_table.module:75
 [warning] Attempt to read property "Field" on bool view_custom_table.module:79
 [warning] Attempt to read property "Type" on bool view_custom_table.module:82
 [warning] Attempt to read property "Type" on bool view_custom_table.module:87
 [warning] Attempt to read property "Field" on bool view_custom_table.module:94
 [warning] Undefined array key "table_database" view_custom_table.module:101
 [warning] Attempt to read property "Field" on bool view_custom_table.module:79
 [warning] Attempt to read property "Type" on bool view_custom_table.module:82
 [warning] Attempt to read property "Type" on bool view_custom_table.module:87
 [warning] Attempt to read property "Field" on bool view_custom_table.module:94
 [warning] Attempt to read property "Field" on bool view_custom_table.module:171
 [warning] Attempt to read property "Field" on bool view_custom_table.module:79
 [warning] Attempt to read property "Type" on bool view_custom_table.module:82
 [warning] Attempt to read property "Type" on bool view_custom_table.module:87
 [warning] Attempt to read property "Field" on bool view_custom_table.module:94
 [warning] Attempt to read property "Field" on bool view_custom_table.module:171

Proposed resolution

Hook view_custom_table_views_data() should check for the existence of array keys and object properties.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom Simon Peacock

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