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.

Command icon 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:

Comments

Simon Peacock created an issue. See original summary.

simon peacock’s picture

simon peacock’s picture

Version: 2.0.4 » 2.0.x-dev
simon peacock’s picture

simon peacock’s picture

Status: Active » Needs review
dmezquia’s picture

I am also getting similar warnings in the .module.

tashaharrison80 made their first commit to this issue’s fork.

joseph.olstad’s picture

Status: Needs review » Needs work

Merge conflicts with MR 21

joseph.olstad’s picture

To 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.

diff --git a/view_custom_table.module b/view_custom_table.module
index 376e913..f8ce504 100644
--- a/view_custom_table.module
+++ b/view_custom_table.module
@@ -83,6 +83,10 @@ function view_custom_table_views_data() {
           $column_type_values = explode('(', $column->Type);
           $column_type = $column_type_values[0];
         }
+        else if (strpos($column->Type, ' unsigned')) {
+          $column_type_values = explode(' unsigned', $column->Type);
+          $column_type = $column_type_values[0];
+        }
         else {
           $column_type = $column->Type;
         }
joseph.olstad’s picture

joseph.olstad’s picture

StatusFileSize
new14.44 KB

Re-rolled by refactoring conflicts in a friendly manner.

joseph.olstad’s picture

Status: Needs work » Needs review
joseph.olstad’s picture

Status: Needs review » Needs work

The last submitted patch, 13: view_custom_table-3363668-13.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

joseph.olstad’s picture

Status: Needs work » Fixed

Tagging this change as 2.0.6-beta1

I'll revert this if there's any regressions.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.