bug #38140 [DI] dump OS-indepent paths in the preload file (nicolas-grekas)

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
-------

e8feba5c36 [DI] dump OS-indepent paths in the preload file
This commit is contained in:
Fabien Potencier 2020-09-10 19:00:34 +02:00
commit 4bbb250d83

View File

@ -27,7 +27,7 @@ final class Preloader
foreach ($list as $item) {
if (0 === strpos($item, $cacheDir)) {
file_put_contents($file, sprintf("require_once __DIR__.%s;\n", var_export(substr($item, \strlen($cacheDir)), true)), \FILE_APPEND);
file_put_contents($file, sprintf("require_once __DIR__.%s;\n", var_export(strtr(substr($item, \strlen($cacheDir)), \DIRECTORY_SEPARATOR, '/'), true)), \FILE_APPEND);
continue;
}