Problem/Motivation

In some circumstances, the dependency array in generated .info.yml files can be keyed by (non-sequential) integers.

Steps to reproduce:

  • Create a new bundle and configure it to include an install profile.
  • Ensure the 'profile' assignment plugin is enabled.
  • Generate the feature named for the install profile and examine its .info.yml file. Note that the dependencies (which are the result of merging in the standard profile's dependencies) are keyed by integers.

This issue can be traced to FeaturesManager::arrayMergeUnique(), which retains keys in merging arrays.

Proposed resolution

Convert existing public method FeaturesManager::arrayMergeUnique() into inf-specific ::mergeInfoArray(), using NestedArray::mergeDeep().

API changes

Removed FeaturesManager::arrayMergeUnique(), replaced with ::mergeInfoArray().

CommentFileSizeAuthor
#8 features-unique-dependencies-2596029-8.patch691 bytesnedjo

Comments

nedjo created an issue. See original summary.

mpotter’s picture

We need a way to reproduce this one.

nedjo’s picture

Issue summary: View changes

Added steps to reproduce to summary.

nedjo’s picture

Issue summary: View changes

  • nedjo committed 6704557 on 8.x-3.x
    Issue #2596029 by nedjo: Fix numeric keys added to dependency array in...
nedjo’s picture

Status: Active » Fixed
nedjo’s picture

Status: Fixed » Active

Getting duplicate values for dependencies after regenerating a feature.

Cause: NestedArray::mergeDeep() produces duplicate values when merging a non-associative array, so it addresses the numeric key issue but doesn't work for our use case.

nedjo’s picture

Status: Active » Needs review
StatusFileSize
new691 bytes

This may work, but feels like a hack.

  • nedjo committed e069da2 on 8.x-3.x
    Issue #2596029 by nedjo: fix duplicate values in dependency array.
    
nedjo’s picture

Status: Needs review » Fixed

Good enough I guess.

  • nedjo committed e06f949 on 8.x-3.x
    Issue #2596029 by nedjo: Fix pass by reference issue.
    

Status: Fixed » Closed (fixed)

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