-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Dependency-Injection] OPcache preload-file not being generated #34897
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
Comments
This is fixed in the case where both dirs are subdirs of the same hierarchy ( |
I think so yes. |
OK, that's unfortunate 🙁 but thanks for confirming 👍 |
@nicolas-grekas Is the limitation a PHP or a Symfony one? If Symfony: I'm then wondering about the point of being able to override the default Thanks for your feedback on this, as our current container build strategy is having |
Uh oh!
There was an error while loading. Please reload this page.
Hello :)
Symfony version(s) affected: >= 4.4.0
Description
We tried to enable opcache preloading on php 7.4 but the
App_KernelProdContainer.preload.php
file is not being generated. For our cache we use a custom directory outside of the project-directory. This is accomplished by overridinggetCacheDir
in the Kernel. If we use the default implementation ofgetCacheDir
the generated cache contains the preload file.How to reproduce
getCacheDir
-Function and return a custom cache-dir outside of the projects path.bin/console cache:clear --env=prod
/var/application/cache/prod/
Possible Solution
In the PhpDumper-Class the autoload-file for the project is determined in the
getAutoloadFile
-method. The autoloader-file is only returned if it's path matches the$this->targetDirRegex
, which is based on the target directory for the cache. This regex would match any autoloader contained in two directories higher than the cache-dir itself. Therefore it works if your cache is stored in%PROJECT_DIR%/var/cache/prod
, but not if it is stored somewhere else.The determination of the autoloader should therefore also/only include any files found under
kernel.project_dir
.If my assumptions are correct I would happily provide a pull-request and try to fix this.
Additional context
/var/application/cache
for our cache and/var/www/symfony
for the project itself.The text was updated successfully, but these errors were encountered: