Bug #75737 [Opn]: Opcache has corrupt method signatures after invalidation via files
| From: | nikic@php.net | Date: | Wed, 27 Dec 2017 12:17:13 +0000 |
| Subject: | Bug #75737 [Opn]: Opcache has corrupt method signatures after invalidation via files | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-213292@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75737&edit=1
ID: 75737
Updated by: nikic@php.net
Reported by: stephan dot lueckl at niceshops dot com
Summary: Opcache has corrupt method signatures after
invalidation via files
Status: Open
Type: Bug
Package: opcache
Operating System: Debian 8
PHP Version: 7.1.12
Block user comment: N
Private report: N
New Comment:
Can you please provide your opcache related ini configuration? Also, if you say it did not occur
prior to 7.1.9, do you mean that you are observing the problem in 7.1.9 but not 7.1.8, or that you
upgraded directly from 7.1.8 to 7.1.12 and seeing the problem now?
Previous Comments:
------------------------------------------------------------------------
[2017-12-27 12:12:51] stephan dot lueckl at niceshops dot com
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 this bug report at https://bugs.php.net/bug.php?id=75737&edit=1