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.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | view_custom_table-3363668-13.patch | 14.44 KB | joseph.olstad |
Issue fork view_custom_table-3363668
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:
- 3363668-undefined-array-key
changes, plain diff MR !23
Comments
Comment #2
simon peacock commentedComment #3
simon peacock commentedComment #4
simon peacock commentedRollback for 2.0.4
Comment #5
simon peacock commentedComment #6
dmezquiaI am also getting similar warnings in the .module.
Comment #9
joseph.olstadMerge conflicts with MR 21
Comment #10
joseph.olstadTo fix the conflict from 2.0.5, revert this first, then apply patch #4 , however if you want to have a patch that applies to the HEAD of 2.0.x then refer to patch #13 as there's another additional conflict in 2.0.x dev that is resolve with patch #13.
generate new patch from this.
Revert this change first.
Comment #11
joseph.olstad#3296864: Unsigned int-type columns are not added in hook_views_data()
Comment #12
joseph.olstadComment #13
joseph.olstadRe-rolled by refactoring conflicts in a friendly manner.
Comment #14
joseph.olstadComment #15
joseph.olstadComment #18
joseph.olstadTagging this change as 2.0.6-beta1
I'll revert this if there's any regressions.
Comment #19
joseph.olstadhttps://www.drupal.org/project/view_custom_table/releases/2.0.6-beta1