-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New Preloader related issues causing "Failed opening required '/var/www\vendor/autoload.php'" #38123
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
Can you please try this patch? It changes back-slashes into forward-slashes in dumped containers, making them path-independent. --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
@@ -2056,7 +2056,13 @@ EOF;
$suffix = $matches[0][1] + \strlen($matches[0][0]);
$matches[0][1] += \strlen($matches[1][0]);
$prefix = $matches[0][1] ? $this->doExport(substr($value, 0, $matches[0][1]), true).'.' : '';
- $suffix = isset($value[$suffix]) ? '.'.$this->doExport(substr($value, $suffix), true) : '';
+
+ if ('\\' === \DIRECTORY_SEPARATOR && isset($value[$suffix])) {
+ $suffix = '.'.$this->doExport(str_replace('\\', '/', substr($value, $suffix)), true);
+ } else {
+ $suffix = isset($value[$suffix]) ? '.'.$this->doExport(substr($value, $suffix), true) : '';
+ }
+
$dirname = $this->asFiles ? '$this->containerDir' : '__DIR__';
$offset = 2 + $this->targetDirMaxMatches - \count($matches); |
Yes, it's getting better, but then it's failing for the twig imports. I changed the first require_once manually. I also had to remove
because of |
Problem comes from the fact that the preload.php file is stored under src/, which is managed by the DebugClassLoader. So, we either need to have some special treatment for the file, or move it elsewhere. |
Pulling it out of src would be advantageous. At least I had to exclude it from the service configuration as well. |
...ahm... I think this solved the issue. After extending service exlusion by
And it now even works without the suggested changes from Nikolas. Did you mention this somewhere in the docs? |
This PR was merged into the 4.4 branch. Discussion ---------- [FrameworkBundle] adopt src/.preload.php | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #38123 | License | MIT | Doc PR | - The leading dot prevents PSR-4 discovery from considering the file. Commits ------- f4c47eb [FrameworkBundle] adopt src/.preload.php
…olas-grekas) This PR was merged into the 4.4 branch. Discussion ---------- [DI] dump OS-indepent paths in the compiled container | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #38123 | License | MIT | Doc PR | - This allows compiling on Windows and running on Linux (Docker). Commits ------- 4dcf9e7 [DI 6B59 ] dump OS-indepent paths in the compiled container
…rekas) This PR was merged into the 5.1 branch. Discussion ---------- [DI] dump OS-indepent paths in the preload file | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #38123 | License | MIT | Doc PR | - This allows generating the file on Windows and running it on Linux (Docker). Commits ------- e8feba5 [DI] dump OS-indepent paths in the preload file
Symfony version(s) affected: 5.1.6
Description
Path resolution does not work with the newly integrated cache handler
cache/Xxx_KernelProdDebugContainer.preload.php
require dirname(__DIR__, 3).'\\vendor/autoload.php';
The two backslashes are resolved to this square character:
.\�endor/autoload.php
(see picture) since \v is an escape secquence for vertical jumps, as far as I remember.The screenshot below show the debug output.
How to reproduce
$ composer dump-env prod
Possible Solution
Also,
dirname(__DIR__,3)
doesnt resolve correctly (might be a configuration issue from my side/app).The only temp solution is to change to this weird non-scalable path settings:
Additional context

The text was updated successfully, but these errors were encountered: