bug #36796 [DI] Use require_once instead of require when appending cache warmer-returned files to preload file (ovrflo)

This PR was merged into the 5.1-dev branch.

Discussion
----------

[DI] Use require_once instead of require when appending cache warmer-returned files to preload file

Use require_once instead of require when appending cache warmer-returned files to preload file.

| Q             | A
| ------------- | ---
| Branch?       | master/5.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #36793
| License       | MIT

As requested in #36793, I have changed the Preloader to append files with `require_once` (instead of the existing `require`). This should also help for cases when multiple CacheWarmers return the same file(s).

Commits
-------

a53d12674c bug #36793 [DI][Preload] Use require_once instead of require when appending cache warmer-returned files to preload file.
This commit is contained in:
Nicolas Grekas 2020-05-12 21:00:26 +02:00
commit 869770c952
1 changed files with 1 additions and 1 deletions

View File

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