Edit report at https://bugs.php.net/bug.php?id=65559&edit=1
ID: 65559
Comment by: zoeslam at gmail dot com
Reported by: zoeslam at gmail dot com
Summary: Opcache: cache not cleared if changes occur while
running
Status: Open
Type: Bug
Package: opcache
Operating System: Ubuntu
PHP Version: 5.5.3
Block user comment: N
Private report: N
New Comment:
Maybe you are right, but this is a huge inconsistency, difference and compatibility break from APC,
which was the default opcache in 5.4.
(Just tested with Opcache disabled and php -d extension=apc.so -d apc.enabled=1 -d apc.enable_cli=1
test.php)
Previous Comments:
------------------------------------------------------------------------
[2013-11-04 14:48:41] arjen at react dot com
Don't think this is a bug. opcache_invalidate()/opcache_reset() isn't called after the
updated file is written to disk, so the opcache just doesn't know the file on disk has changed.
The timestamps are only validated every 2 sec. by default, but only once per request.
See http://www.php.net/manual/en/opcache.configuration.php#ini.opcache.revalidate-freq
and Speed Tuning @ https://github.com/zendtech/ZendOptimizerPlus
------------------------------------------------------------------------
[2013-10-23 14:09:38] zoeslam at gmail dot com
Of course, if you try the test in CLI, make sure to enable the opcache even in the cli:
php -d opcache.enable=1 -d opcache.enable_cli=1 test.php
------------------------------------------------------------------------
[2013-08-26 12:41:21] zoeslam at gmail dot com
Description:
------------
The new Zend OPcache doesn't clear the cache if a file is changed on the fly.
Instead the test script works well with opcache turned off (opcache.enable=0).
Test script:
---------------
<?php
$file = __DIR__.'/file.txt';
file_put_contents($file, '<?php return 1;');
$var = include $file;
file_put_contents($file, '<?php return 2;');
$var = include $file;
var_dump($var);
Expected result:
----------------
int(2)
Actual result:
--------------
int(1)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65559&edit=1