Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Using one environment variable to configure multiple bundles results in validation failure(s) #36466

Copy link
Copy link
Closed
@jorijn

Description

@jorijn
Issue body actions

Symfony version(s) affected: 4.4.7

Description
If a developer uses a generic environment variable to configure two or more different bundles, the (bundle) configuration placeholder / validation logic breaks in MergeExtensionConfigurationPass and BaseNode.

In IntegerNode.php line 29:
  Invalid type for path "test_queue.ttl.default". Expected int, but got string.

How to reproduce
Bug reproducer project here: https://github.com/Jorijn/symfony_issue_36466.

Commit that holds the specific code to reproduce: jorijn/symfony_issue_36466@c7d6d5b

  1. Install this repository. I created two internal bundles to simulate external dependencies.
  2. See config/test_cache.yaml and config/test_queue.yaml. Both configure their respective bundle with a (example) TTL value of type integer. They both reference the same generic environment variable: GENERIC_TTL_VALUE of value "100".
  3. Run the application or command on an uncompiled container with: php bin/console app:test-combined-parameters
  4. The Symfony internals will provide a type matched (integer) placeholder to feed into the validation of the application configuration.
    Unproven suspicions hereafter
  5. After the first bundle is handled in MergeExtensionConfigurationPass it presumably clears the env var placeholder list in BaseNode::$placeholders
  6. The second bundle is unable to fetch the integer placeholder and stays on the default value of env_b47212d4eceb452c_int_GENERIC_TTL_VALUE_9c6a30a1aa87aefcade48d2c6bf6edb0 which is not an integer, this results in the validation failure.

Environment specifics

❯ php -v
PHP 7.2.29 (cli) (built: Mar 19 2020 11:18:10) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans
    with Zend OPcache v7.2.29, Copyright (c) 1999-2018, by Zend Technologies

If you need more information let me know.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.