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:
commit
869770c952
@ -27,7 +27,7 @@ final class Preloader
|
|||||||
|
|
||||||
foreach ($list as $item) {
|
foreach ($list as $item) {
|
||||||
if (0 === strpos($item, $cacheDir)) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user