Fabien Potencier 5815c8344b minor #1796 OPcache support fix (iKwinto)
This PR was squashed before being merged into the 1.x branch (closes #1796).

Discussion
----------

OPcache support fix

According this recipe http://twig.sensiolabs.org/doc/recipes.html#refreshing-modified-templates-when-opcache-or-apc-is-enabled when using OPcache:

```
class Twig_Environment_APC extends Twig_Environment
{
    protected function writeCacheFile($file, $content)
    {
        parent::writeCacheFile($file, $content);

        // Compile cached file into bytecode cache
        if (extension_loaded('Zend OPcache') && ini_get('opcache.enable')) {
            opcache_compile_file($file);
        } elseif (extension_loaded('apc') && ini_get('apc.enabled')) {
            apc_compile_file($file);
        }
    }
}
```

it takes an error:

```
Cannot redeclare class __TwigTemplate_12e7606b10ee267fa4174f660f86451aed936cc5680300a6442092f337c910cf
```

This is due to fact that the function ```opcache_compile_file($file)``` executes the file. But it should not do so in accordance with the documentation: http://php.net/manual/en/function.opcache-compile-file.php

There is a bug report: https://bugs.php.net/bug.php?id=66066 (since 2013 👎).

This patch prevents reexecution of the compiled template.

Commits
-------

2c4af24 OPcache support fix
2015-08-27 09:48:00 +02:00
2015-08-27 09:47:21 +02:00
2015-08-27 09:47:21 +02:00
2015-08-27 09:47:21 +02:00
2015-08-27 09:47:21 +02:00
2015-01-20 03:31:04 +01:00
2015-08-27 09:47:21 +02:00
2015-08-27 09:47:21 +02:00
2015-08-27 09:47:21 +02:00
2015-08-27 09:47:21 +02:00
2013-11-11 20:04:42 +01:00

Twig, the flexible, fast, and secure template language for PHP
==============================================================

Twig is a template language for PHP, released under the new BSD license (code
and documentation).

Twig uses a syntax similar to the Django and Jinja template languages which
inspired the Twig runtime environment.

More Information
----------------

Read the `documentation`_ for more information.

.. _documentation: http://twig.sensiolabs.org/documentation
Languages
PHP 99.9%