Bug #75737 [NEW]: Opcache has corrupt method signatures after invalidation via files
| From: | stephan dot lueckl at niceshops dot com | Date: | Wed, 27 Dec 2017 12:12:55 +0000 |
| Subject: | Bug #75737 [NEW]: Opcache has corrupt method signatures after invalidation via files | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-213291@lists.php.net to get a copy of this message | ||
From: stephan dot lueckl at niceshops dot com
Operating system: Debian 8
PHP version: 7.1.12
Package: opcache
Bug Type: Bug
Bug description:Opcache has corrupt method signatures after invalidation via files
Description:
------------
Some examples from the error log (error log is full with this):
1) PHP Fatal error: Uncaught TypeError: Argument 1 passed to
ServiceDb_Session::__construct() must be an instance of
DB_Generated_ShopWAWIProduct, instance of ServiceDb_Connection given,
called in Factory.php on line 25 and defined in Session.php:41
2) PHP Fatal error: Uncaught TypeError: Argument 1 passed to
ServiceDb_Session::__construct() must be an instance of
Smarty_Internal_Template, instance of ServiceDb_Connection given, called
in Factory.php on line 25 and defined in Session.php:41
3) PHP Fatal error: Uncaught TypeError: Argument 1 passed to
ServiceDb_Session::__construct() must be an instance of
ServiceDb_Connection, instance of ServiceDb_Connection given, called in
Factory.php on line 25 and defined in Session.php:41
The session classes are part of an overwritten session handler, that
implements the SessionHandlerInterface.
You can see - the method signature of the class somehow is corrupted
(interesting in example 3: expectation and actual value is equal)
This happens after we reinvalidate the opcache via files (reinvalidation
script below) - within the reinvalidation this type of session with the
overwritten sessionhandler is started.
At the moment this problem only occurs within this session classes.
As this happens once - all requests to the server are having this error
(the overwritten session system is used in every case).
Problem can be fixed by calling opcache_reset();
This problem did not occur prior to PHP 7.1.9
Test script:
---------------
Method Signature
class ServiceDb_Connection
{
/**
* @var ServiceDb_Connection
*/
private $connection;
public function __construct(ServiceDb_Connection $connection)
{
$this->connection = $connection;
}
}
Opcache Invalidation Script (invalidates the cache from the project base
root):
$opStatus = opcache_get_status(true);
if (is_array($opStatus["scripts"])) {
foreach ($opStatus["scripts"] as $file => $info) {
if (strpos($file,BASE_ROOT) === 0) {
opcache_invalidate($file);
}
}
}
--
Edit bug report at https://bugs.php.net/bug.php?id=75737&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75737&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75737&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75737&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75737&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75737&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75737&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75737&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75737&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75737&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75737&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75737&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75737&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75737&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75737&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75737&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75737&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75737&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75737&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75737&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75737&r=mysqlcfg