8000 `bin/console debug:config XXXX` does't work when the config is not defined in the **application** · Issue #41121 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

bin/console debug:config XXXX does't work when the config is not defined in the **application** #41121

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

Closed
lyrixx opened this issue May 6, 2021 · 3 comments
Labels
Bug DependencyInjection Help wanted Issues and PRs which are looking for volunteers to complete them. Status: Needs Review

Comments

@lyrixx
Copy link
Member
lyrixx commented May 6, 2021

Symfony version(s) affected: 4.4.*

Description

root /app bin/console debug:config JMSSerializerBundle

In ConfigDebugCommand.php line 92:
                                                                          
  The extension with alias "jms_serializer" does not have configuration.  
                                                                          

debug:config [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<name> [<path>]]

How to reproduce

Drop all the configuration of a bundle

Possible Solution

Dump the real configuration, even if the app definition does not exists.

Additional context

root /app bin/console debug:config --help
Description:
  Dumps the current configuration for an extension

The help says it dump the currentconfiguration, it means the configuration defined in the application merged with the default one (I know it, I made this feature).

This line cause the issue:

|| !$config = array_filter($container->getExtensionConfig($name))

I can submit a PR to remove it if you are OK

@ro0NL
Copy link
Contributor
ro0NL commented May 6, 2021

i think i broke this unintendedly in #30648

ideally we'd solve this from the debug command somehow, or put different im not sure we should start processing empty config to get a default for this purpose 🤔

@chalasr
Copy link
Member
chalasr commented May 9, 2021

The command could fallback to the old way of getting the default config

@lyrixx
Copy link
Member Author
lyrixx commented Jul 23, 2021

Do someone want to work on it?

@chalasr chalasr added the Help wanted Issues and PRs which are looking for volunteers to complete them. label Jul 23, 2021
fabpot added a commit that referenced this issue Aug 26, 2021
…bug:config and consistently resolve parameter values (herndlm)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] Fall back to default configuration in debug:config and consistently resolve parameter values

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #41121
| License       | MIT
| Doc PR        | n/a

Brings back determining the default configuration from pull request #30648. Refactors determining the extension config into a helper method to keep cognitive load low with early exits instead of nested ifs.

Additionaly, while reviewing, we noticed that entries with parameters are not resolved correctly if they come from the default config and an application config is existing but they are not overriden. E.g. the session config for the framework would output `save_path: %kernel.cache_dir%/sessions` instead of the resolved value.

Tested via unit test (obviously) and by manually removing bundle configuration in a Symfony project.

Beware that I do not know much about bundles and internals, I looked that up while implementing this and might have missed better/simpler solutions or edge cases. Please somebody also do another functional test to ensure this is really working as it should.

Commits
-------

9b6110b [FrameworkBundle] Fall back to default configuration in debug:config and consistently resolve parameter values
@fabpot fabpot closed this as completed Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug DependencyInjection Help wanted Issues and PRs which are looking for volunteers to complete them. Status: Needs Review
Projects
None yet
Development

No branches or pull requests

5 participants
0