If any of a site's component machine names are "options" or "selected", there will be a collision with the reserved Features arrays (with the same names) used in the component export data.
The problem is in FeaturesEditForm.php:
$component_export['options'][$section] = array();
$component_export['selected'][$section] = array();
If there already is a component with one of these names, PHP issues:
Warning: Illegal string offset 'sources' in Drupal\features_ui\Form\FeaturesEditForm->getComponentList() (line 613 of /path/to/drupal/modules/contrib/features/modules/features_ui/src/Form/FeaturesEditForm.php
...and then:
Fatal error: Cannot use string offset as an array in /path/to/drupal/modules/contrib/features/modules/features_ui/src/Form/FeaturesEditForm.php on line 752
...when clicking on the Create new feature button.
I ran into this because we've got a custom entity with "options" as bundle/machine name.
I'll have a patch for this in a minute.
Comment | File | Size | Author |
---|---|---|---|
#2 | features-colliding_reserved_component_list_names-2639960-2.patch | 8.23 KB | colan |
|
Comments
Comment #2
colanI replaced "options" and "selected" with "_features_options" and "_features_selected" respectively so that they're less likely to clash with anything.
Thanks to dawehner for help in coming up with the plan.
There are some other instances of 'selected' in that file, but I think that they're for a different purpose. In my case, the button now works, and I can't see any related issues on the feature-create form.
Comment #3
dawehnerLooks perfect for me! Writing test coverage for that specific bug might be a little hard.
Comment #5
nedjoThanks, committed.
Comment #6
nedjo