This was a very weird bug, but essentially, what happened:

  1. I wanted to add a new column to field schema
  2. I passed the $field with updated setting so that the $new_schema would contain the additional column.
  3. $old_schema is generated by array_intersect_key() from $field
  4. After $new_schema is generated, columns are added to $field['data']
  5. The trick is: $field['columns'] is a reference to $field['data']['columns'], and array_intersect_key() *preserves* the reference so that $old_schema['columns'] is a reference to $field['data']['columns'].
  6. So basically, the code fails when it checks if all $old_schema['columns'] exist because these are actually the $new_schema['columns']

I had no idea about this referencing behavior of array_intersect_key(), but after replacing it with a normal assignment, everything works. Patch is attached.

CommentFileSizeAuthor
helper_change_schema_references.patch829 bytesfranz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

franz created an issue.