Skip to content
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

[Framework-Bundle] fixed kernel.secret not being overridden when loaded from extension using MicroKernelTrait #36082

Merged
merged 1 commit into from Mar 15, 2020

Conversation

@jrushlow
Copy link
Contributor

jrushlow commented Mar 15, 2020

Q A
Branch? master
Bug fix? yes
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

Previously, when extending Kernel::class and using the MicroKernelTrait::class setting the secret like

protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
    {
        $container->loadFromExtension('framework', [ 'secret' => 'foo',]);

would not replace the kernel.secret parameter set by $container->setParameter('kernel.secret', '%env(APP_SECRET)%'); in the MicroKernelTrait.

Initiating a service with a secret argument without a APP_ENV value set in .env would throw:
Symfony\Component\DependencyInjection\Exception\EnvNotFoundException : Environment variable not found: "APP_SECRET".

This PR allows the kernel.secret set in the MicroKernelTrait::registerContainerConfiguration() to be overridden in a class extending Kernel while using the trait.

Thanks @nicolas-grekas for the help on this one.

@jrushlow jrushlow changed the title fixed kernel.secret not being overridden when loaded from extension using MicroKernelTrait [Framework-Bundle] fixed kernel.secret not being overridden when loaded from extension using MicroKernelTrait Mar 15, 2020
@fabpot
fabpot approved these changes Mar 15, 2020
@fabpot

This comment has been minimized.

Copy link
Member

fabpot commented Mar 15, 2020

Thank you @jrushlow.

@fabpot fabpot merged commit bfca6b9 into symfony:master Mar 15, 2020
1 of 3 checks passed
1 of 3 checks passed
continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details
fabbot.io Your code looks good.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.