-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection][3.3] Warning: stripos() expects parameter 1 to be string, array given #25245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
How did you create an env that is an array? Using defaults? Using the "json:" processor? |
For us we get this issue when we have array parameters and env var parameters. They don't interact with each other, they are just both defined. Heres a script I use to repro: # test.yaml
parameters:
example: '%env(RANDOM_VARIABLE)%'
parameter_array:
- '/path1'
- '/path2'
services:
test_service:
class: 'Symfony\Component\Config\FileLocator'
arguments: ['%parameter_array%'] <?php
# test.php
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\Config\FileLocator;
require __DIR__ . '/vendor/autoload.php';
putenv('RANDOM_VARIABLE=testing');
$container = new ContainerBuilder;
$loader = new YamlFileLoader($container, new FileLocator(__DIR__));
$loader->load('test.yaml');
$container->compile(true);
$test = $container->get('test_service'); Symfony 3.3.x
Symfony 3.4.x(Symfony 4.x has same results)
|
Yep, with the change 3.3, 3.4, and 4.0 all seem to work as expected, giving the same results. |
… array as container parameter (Phantas0s) This PR was squashed before being merged into the 3.3 branch (closes #25333). Discussion ---------- [DI] Impossible to set an environment variable and then an array as container parameter | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #25245 | License | MIT When an environment variables and then an array is set as container parameters, an error is thrown (Warning: stripos() expects parameter 1 to be string, array given). You can run my test without the fix in the Container builder to see it. Commits ------- 484a082 [DI] Impossible to set an environment variable and then an array as container parameter
Uh oh!
There was an error while loading. Please reload this page.
I have this bug which is related (I think) to some modification you did in the ContainerBuilder.
This is due to some environment variables I have which is an array. In the ContainerBuilder:
I think you need to put this condition
before this conditional:
The text was updated successfully, but these errors were encountered: