Bug #69281 [Asn->Csd]: opcache_is_script_cached no longer works

From: Date: Thu, 02 Apr 2015 01:07:55 +0000
Subject: Bug #69281 [Asn->Csd]: opcache_is_script_cached no longer works
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191774@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69281&edit=1 ID: 69281 Updated by: laruence@php.net Reported by: danack@php.net Summary: opcache_is_script_cached no longer works -Status: Assigned +Status: Closed Type: Bug Package: opcache Operating System: Centos PHP Version: 5.6.7 Assigned To: dmitry Block user comment: N Private report: N New Comment: Automatic comment on behalf of Danack@basereality.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=86f983bd3ea13def42e36842e03f785d02d40a7f Log: Fixed bug #69281 (opcache_is_script_cached no longer works) Previous Comments: ------------------------------------------------------------------------ [2015-03-27 15:03:52] danack@php.net The bug is in two parts, first the timestamp is only set if the opcache.validate_timestamps is enabled: http://lxr.php.net/xref/PHP_TRUNK/ext/opcache/ZendAccelerator.c#1449 But then OPCache is assuming that the file is only cached if the timestamp is set to not zero. http://lxr.php.net/xref/PHP_TRUNK/ext/opcache/ZendAccelerator.c#853 ------------------------------------------------------------------------ [2015-03-27 14:21:17] danack@php.net It's possible I'm doing something dumb, but I've tested this against freshly compiled versions of 5.6.2 and 5.6.7 and there does seem to be different behaviour. File /etc/php.ini ================= zend_extension=opcache.so opcache.validate_timestamps=off opcache.enable=1 memory_limit=127M test.php ========= <?php var_dump(opcache_is_script_cached(__FILE__)); Configure script ================ ./configure \ --bindir=/usr/bin \ --sbindir=/usr/sbin \ --sysconfdir=/etc \ --localstatedir=/var \ --with-config-file-path=/etc \ --with-config-file-scan-dir=/etc/php.d \ --disable-cgi \ --disable-rpath \ --enable-xmlreader \ --enable-xmlwriter \ --enable-apcu \ --enable-fpm \ --enable-intl \ --enable-json \ --enable-mbregex \ --enable-mbstring \ --enable-pcntl \ --enable-pdo \ --enable-sockets \ --enable-sysvsem \ --enable-sysvshm \ --enable-zip \ --with-bz2 \ --with-curl \ --with-freetype-dir=/usr/lib \ --with-gd \ --with-jpeg-dir=/usr/lib \ --without-mcrypt \ --with-png-dir=/usr/lib \ --enable-fd-setsize=8192 \ --with-pdo-mysql \ --with-yaml \ --with-zlib \ --without-mhash \ --with-mysql \ --with-mysqli=mysqlnd \ --with-openssl \ --with-pcre-regex \ --without-pear \ --enable-maintainer-zts I'm using the builtin webserver to test php -S 127.0.0.1:80 and then wget -O php5.6.2.test 127.0.0.1/test.php and the same command with a different output filename for 5.6.7 I'm still seeing that the file is cached according to 5.6.2 and isn't according to 5.6.7 ------------------------------------------------------------------------ [2015-03-24 05:43:27] laruence@php.net I can not reproduce this with php-fpm (5.6 branch) ------------------------------------------------------------------------ [2015-03-23 15:09:22] danack@php.net Description: ------------ The function opcache_is_script_cached is meant to return true if a script is already cached and present in OPCache. This is failing when running in the fpm-cgi in 5.6.7. It works when: * called from the CLI sapi. * in the fpm-cgi sapi in 5.6.2 Test script: --------------- <?php var_dump(opcache_is_script_cached(__FILE__)); var_dump(opcache_is_script_cached(realpath(__FILE__))); //The current file should always be present, as it is compiled and cached before being run. Expected result: ---------------- bool(true) bool(true) Actual result: -------------- bool(false) bool(false) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69281&edit=1

« previous php.bugs (#191774) next »