Skip to content

[DependencyInjection][Bug] Environment variables incorrectly makes placeholder an array #20213

Closed
@mickadoo

Description

@mickadoo

Following code review changes on #20199 (review) I reverted the mergeEnvPlaceholders. However I think I probably shouldn't have changed it as it seems to be broken now. array_merge_recursive will create this structure when the placeholder is initialized inside EnvPlaceholderParameterBag::get()

[
  'DB_DRIVER' => 
  [
    'env_DB_DRIVER_uniq_string' => 'env_DB_DRIVER_uniq_string',
  ],
]

And then once mergeEnvPlaceholders is called it results in

[
  'DB_DRIVER' =>
    [
      'env_DB_DRIVER_uniq_string' => 
      [
        0 => 'env_DB_DRIVER_uniq_string',
        1 => 'env_DB_DRIVER_uniq_string',
      ],
   ]
]

Which causes an error inside ContainerBuilder::resolveEnvPlaceholders as the placeholder is an array instead of a string.

ContextErrorException in ContainerBuilder.php line 1045: Warning: stripos(): needle is not a string or an integer

I don't think this can be fixed inside the envPlaceholders assignment because it's an issue related to the merging of two parameter bags, not the assignment of them. I would suggest using the original fix I proposed inside mergeEnvPlaceholders

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions