bug #24421 [Config] Fix dumped files invalidation by OPCache (nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[Config] Fix dumped files invalidation by OPCache

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

While demoing Flex, I've noticed that container invalidation takes a few seconds on my setup.
I've debugged that down to OPcache, which serves the legacy container while it's been overridden.
Let's invalidate the file explicitly when it changes.

Commits
-------

b1290da21b [Config] Fix dumped files invalidation by OPCache
This commit is contained in:
Fabien Potencier 2017-10-04 11:52:35 -07:00
commit 253cde2062
1 changed files with 4 additions and 0 deletions

View File

@ -149,6 +149,10 @@ class ConfigCache implements ConfigCacheInterface
// discard chmod failure (some filesystem may not support it)
}
}
if (\function_exists('opcache_invalidate') && ini_get('opcache.enable')) {
@opcache_invalidate($this->file, true);
}
}
/**