Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DependencyInjection] PHPDumper hardwires polyfills into build container file #44866

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
shyim opened this issue Dec 30, 2021 · 3 comments
Closed

Comments

@shyim
Copy link
Contributor

shyim commented Dec 30, 2021

Symfony version(s) affected

5.4

Description

When parmeter container.dumper.inline_class_loader is enabled, it will hardwire also Polyfill interfaces like Stringable.

 protected function getSecrets_VaultService()
    {
        include_once \dirname(__DIR__, 4).'/vendor/symfony/framework-bundle/Secrets/AbstractVault.php';
        include_once \dirname(__DIR__, 4).'/vendor/symfony/dependency-injection/EnvVarLoaderInterface.php';
        include_once \dirname(__DIR__, 4).'/vendor/symfony/framework-bundle/Secrets/SodiumVault.php';
        include_once \dirname(__DIR__, 4).'/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php';
        include_once \dirname(__DIR__, 4).'/vendor/symfony/string/LazyString.php';

        return $this->privates['secrets.vault'] = new \Symfony\Bundle\FrameworkBundle\Secrets\SodiumVault((\dirname(__DIR__, 4).'/config/secrets/'.$this->getEnv('string:default:kernel.environment:APP_RUNTIME_ENV')), \Symfony\Component\String\LazyString::fromCallable(\Closure::fromCallable([0 => $this, 1 => 'getEnv']), 'base64:default::SYMFONY_DECRYPTION_SECRET'));
    }

How to reproduce

  • Enable that Parameter
  • Use the interface BEFORE using the container
  • Get the service (looks like symfony secret vault service)
  • PHP Boom as the interface is already defined

Possible Solution

Create a blacklist of which classes should not be included there

Additional Context

No response

@fancyweb
Copy link
Contributor

fancyweb commented Dec 30, 2021

Can you confirm it's the same issue than #44426 please? Or at least related?

@shyim
Copy link
Contributor Author

shyim commented Dec 30, 2021

It goes to same direction, but I guess this case is easier to solve. I would suggest to ignore known polyfills classes to be inlined

@nicolas-grekas
Copy link
Member

Works for me, PR welcome.

chalasr added a commit that referenced this issue Jan 31, 2022
…load script (nicolas-grekas)

This PR was merged into the 4.4 branch.

Discussion
----------

[DependencyInjection] Don't dump polyfilled classes in preload script

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

Commits
-------

c11d664 [DependencyInjection] Don't dump polyfilled classes in preload script
@chalasr chalasr closed this as completed Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants