php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75737 Opcache has corrupt method signatures after invalidation via files
Submitted: 2017-12-27 12:12 UTC Modified: 2017-12-27 12:52 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: stephan dot lueckl at niceshops dot com Assigned:
Status: Open Package: opcache
PHP Version: 7.1.12 OS: Debian 8
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-12-27 12:12 UTC] 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);
		}
	}
}







Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-12-27 12:17 UTC] nikic@php.net
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?
 [2017-12-27 12:52 UTC] stephan dot lueckl at niceshops dot com
Problem did not occur in the versions 7.1.6, 7.1.8, 7.1.9

OPCache settings from phpinfo().

opcache.blacklist_filename	no value	no value
opcache.consistency_checks	0	0
opcache.dups_fix	Off	Off
opcache.enable	On	On
opcache.enable_cli	Off	Off
opcache.enable_file_override	On	On
opcache.error_log	no value	no value
opcache.fast_shutdown	1	1
opcache.file_cache	no value	no value
opcache.file_cache_consistency_checks	1	1
opcache.file_cache_only	0	0
opcache.file_update_protection	2	2
opcache.force_restart_timeout	180	180
opcache.huge_code_pages	Off	Off
opcache.inherited_hack	On	On
opcache.interned_strings_buffer	6	6
opcache.lockfile_path	/tmp	/tmp
opcache.log_verbosity_level	0	0
opcache.max_accelerated_files	262237	262237
opcache.max_file_size	0	0
opcache.max_wasted_percentage	5	5
opcache.memory_consumption	960	960
opcache.opt_debug_level	0	0
opcache.optimization_level	0xffffffff	0xffffffff
opcache.preferred_memory_model	no value	no value
opcache.protect_memory	0	0
opcache.restrict_api	no value	no value
opcache.revalidate_freq	2	2
opcache.revalidate_path	Off	Off
opcache.save_comments	1	1
opcache.use_cwd	On	On
opcache.validate_permission	Off	Off
opcache.validate_root	Off	Off
opcache.validate_timestamps	Off	Off
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Jan 19 01:01:25 2019 UTC