Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This was a very weird bug, but essentially, what happened:
- I wanted to add a new column to field schema
- I passed the $field with updated setting so that the $new_schema would contain the additional column.
- $old_schema is generated by array_intersect_key() from $field
- After $new_schema is generated, columns are added to $field['data']
- 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'].
- 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.
Comment | File | Size | Author |
---|---|---|---|
helper_change_schema_references.patch | 829 bytes | franz | |
Comments