Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Dependency-Injection] Preloading file is not generated #34750

Copy link
Copy link
Closed
@Plopix

Description

@Plopix
Issue body actions

Symfony version(s) affected: 4.4.x and 5.x

The issue was detected on Platform.sh using PHP 7.4 trying to enable the Preloading support.

Description

On Platform.sh the file var/cache/prod/srcApp_KernelProdContainer.preload.php is NOT generated when it is working locally.

How to reproduce

Just deploy an empty app on Platform.sh.
OR (and the following explanation will explain why)

  • Install Symfony locally in your root directory /
  • run bin/console
  • check the cache directory,
  • you will see that the preload file is NOT generated

Reasons

This is happening for 3 combined reasons:

The return of getAutoloadFile is always null is this context.
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php#L306
And that is even explained in the code:

// Build a regexp where the first root dirs are mandatory,
// but every other sub-dir is optional up to the full path in $dir
// Mandate at least 2 root dirs and not more that 5 optional dirs.

Traces that explain the bug better
preg_match: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php#L2055

When it works:

string(54) "ComposerAutoloaderInit7a88e581ff3256a1c9451ad0a87173b8"
string(65) "/Users/plopix/DOCKFILES/NOVACTIVE/INTERNAL/XXX/application/vendor"
string(78) "/Users/plopix/DOCKFILES/NOVACTIVE/INTERNAL/XXX/application/vendor/autoload.php"
string(90) "#/Users/plopix/DOCKFILES/NOVACTIVE/INTERNAL(/XXX(/application(/var(/cache(/dev)?)?)?)?)?#A"

here the preg_match works

When it DOES NOT work (on Platform.sh):

string(54) "ComposerAutoloaderInitb7e173ef0544858adc8ec39ee3ef34c1"
string(11) "/app/vendor"
string(24) "/app/vendor/autoload.php"
string(28) "#/app/var(/cache(/pro_)?)?#A"

here the preg_match DOES NOT work

Solutions
That is a bit deep in the stack and I don't know enough to propose something. But if you tell me I could do it ;)

ping @nicolas-grekas

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.