Bug #70656 [Com]: opcache_reset() breaks "require"

From: Date: Fri, 23 Oct 2015 06:20:51 +0000
Subject: Bug #70656 [Com]: opcache_reset() breaks "require"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196762@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70656&edit=1 ID: 70656 Comment by: ealexs at gmail dot com Reported by: p at wspnr dot com Summary: opcache_reset() breaks "require" Status: Open Type: Bug Package: opcache Operating System: Debian (x86_64 and i686) PHP Version: 7.0Git-2015-10-07 (Git) Block user comment: N Private report: N New Comment: This bug is important, it breaks opcache until php-fpm gets a restart !!! It looks like a very simple fix !!! Probably a bad memcopy there, it does not copy the ending \0 Thanks Previous Comments: ------------------------------------------------------------------------ [2015-10-22 11:45:54] ealexs at gmail dot com Just using PHP7, I don't call opcache_reset() after a while I get something like: <b>Fatal error</b>: require_once(): Failed opening required '/var/www/~users/alex/php7/omi-frame-2/src/controller/App.phpb_my' (include_path='.:/opt/php-7.0.0/lib/php') in <b>/var/www/~users/alex/php7/omi-frame-2/src/init.php</b> on line <b>5</b><br /> It looks like the ending string mark is not copied I need to restart PHP-FPM 2 or 3 times per day Thanks, Alex ------------------------------------------------------------------------ [2015-10-07 04:40:29] p at wspnr dot com Description: ------------ Calling \opcache_reset() breaks the "require" statement on future page loads. The only thing that seems to fix it is restarting PHP-FPM. The require fails, stating that it can't find the file path. The file path listed begins with the correct path, but is then followed by junk data. The 'junk' data seems to be other strings from the file(s). Tested and reproduced on both 64-bit and 32-bit builds. Test script: --------------- This is split into three files, running with opcache enabled: -- file1.php -- <?php namespace my\nsname; require 'file3.php'; class MyClass implements MyInterface {} new MyClass(); echo 'I am file 1'; -- file2.php -- <?php namespace my\nsname; \opcache_reset(); echo 'I am file 2'; -- file3.php -- <?php namespace my\nsname; interface MyInterface {} echo 'I am file 3'; -- TEST -- Load, in sequence: file1.php file2.php file3.php file1.php Expected result: ---------------- I am file 3 I am file 1 I am file 2 I am file 3 I am file 3 I am file 1 Actual result: -------------- I am file 3 I am file 1 I am file 2 I am file 3 Fatal error: require(): Failed opening required 'file3.php\myinte' (include_path='.:') in /.../file1.php on line 5 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70656&edit=1

« previous php.bugs (#196762) next »