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

feat: resolve extension parameters in compiler passes #3684

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

Ocarthon
Copy link

@Ocarthon Ocarthon commented Apr 23, 2024

1. Why is this change necessary?

CompilerPassConfigTrait is used in some shopware compiler passes to read the configuration of the framework extension. The problem is, that parameters (e.g. '%env(DUMMY_ENV)%') will not get resolved. If the Symfony configuration class requires specific types, they may not be satisfied without the resolved values. This will lead to a crash of the kernel.

2. What does this change do, exactly?

Before processing the extension config values in shopware compiler passes, resolve the parameters.

3. Describe each step to reproduce the issue or behaviour.

  • Put the following into config/packages/messenger.yaml
framework:
   messenger:
       transports:
           test:
               dsn: ''
               retry_strategy:
                   max_retries: '%env(int:DUMMY_ENV_VAR)%'
  • Run bin/console -> Kernel will fail to start with the error Invalid type for path "framework.messenger.transports.test.retry_strategy.max_retries". Expected "int", but got "string".

4. Please link to the relevant issues (if any).

5. Checklist

  • I have rebased my changes to remove merge conflicts
  • I have written tests and verified that they fail without my change
  • I have created a changelog file with all necessary information about my changes
  • I have written or adjusted the documentation according to my changes
  • This change has comments for package types, values, functions, and non-obvious lines of code
  • I have read the contribution requirements and fulfil them.

@CLAassistant
Copy link

CLAassistant commented Apr 23, 2024

CLA assistant check
All committers have signed the CLA.

@Ocarthon
Copy link
Author

Ocarthon commented Apr 23, 2024

Note also that this also concerns shopware 6.5.8.X.

@suchmaske
Copy link

I just ran into exactly that issue when trying to upgrade a Shopware project from 6.5.5.x to 6.5.8.x

@shyim
Copy link
Member

shyim commented Apr 23, 2024

We will backport it also too 6.5.x

@Ocarthon Ocarthon force-pushed the feat/compiler-pass-resolve-parameters branch from b25dd70 to 6d1b147 Compare April 24, 2024 09:31
@Ocarthon
Copy link
Author

I also now added a minimal test case for validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants