Closed
Description
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
- Install this repository. I created two internal bundles to simulate external dependencies.
- See
config/test_cache.yaml
andconfig/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"
. - Run the application or command on an uncompiled container with:
php bin/console app:test-combined-parameters
- The Symfony internals will provide a type matched (integer) placeholder to feed into the validation of the application configuration.
Unproven suspicions hereafter - After the first bundle is handled in
MergeExtensionConfigurationPass
it presumably clears the env var placeholder list inBaseNode::$placeholders
- 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.