Skip to content

Commit

Permalink
bug #24421 [Config] Fix dumped files invalidation by OPCache (nicolas…
Browse files Browse the repository at this point in the history
…-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
-------

b1290da [Config] Fix dumped files invalidation by OPCache
  • Loading branch information
fabpot committed Oct 4, 2017
2 parents 817f594 + b1290da commit 253cde2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Symfony/Component/Config/ConfigCache.php
Expand Up @@ -149,6 +149,10 @@ public function write($content, array $metadata = null)
// discard chmod failure (some filesystem may not support it)
}
}

if (\function_exists('opcache_invalidate') && ini_get('opcache.enable')) {
@opcache_invalidate($this->file, true);
}
}

/**
Expand Down

0 comments on commit 253cde2

Please sign in to comment.