Repository navigation
Open
Labels
Description
What type of issue is this?
Exception/Error/Warning/Notice/Deprecation
Operating system + version
Windows
PHP version
8.6
Connector/Database version (if applicable)
No response
Phpfastcache version
9.2.0 ✅
Describe the issue you're facing
Running an application that uses phpfastcache with PHP 8.6 fails. In the php error log I get:
Uncaught exception {"exception":"[object] (ErrorException(code: 0): Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead at XXXX/vendor/phpfastcache/phpfastcache/lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php:460)"} []
Looking through the code sources I get
$ git grep spl_object_hash
lib/Phpfastcache/CacheManager.php: if (\spl_object_hash($cachePool) === \spl_object_hash($cachePoolInstance)) {
lib/Phpfastcache/Cluster/ClusterAggregator.php: $clusterAggregatorName = 'cluster_' . \str_shuffle(\spl_object_hash(new stdClass()));
lib/Phpfastcache/Cluster/ClusterAggregator.php: $splHash = \spl_object_hash($driverPool);
lib/Phpfastcache/Cluster/ClusterAggregator.php: $splHash = \spl_object_hash($driverPool);
lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php: } elseif (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) {
lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php: } elseif (\spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) {
lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php: if (isset($this->itemInstances[$item->getKey()]) && \spl_object_hash($item) !== \spl_object_hash($this->itemInstances[$item->getKey()])) {
lib/Phpfastcache/Core/Pool/CacheItemPoolTrait.php: return \spl_object_hash($item) === \spl_object_hash($this->itemInstances[$item->getKey()]);
lib/Phpfastcache/EventManager.php: }, 'Scoped' . $pool->getDriverName() . spl_object_hash($this));
tests/cases/CacheClearSingleInstance.test.php:$driverInstance2Hash = spl_object_hash($driverInstance2);
tests/cases/CacheClearSingleInstance.test.php: $driverInstanceHash = spl_object_hash($cacheInstance);
Expected behavior
phpfastcache does not use deprecrated functions / functionality from 8.6 and works with that version.
Code sample (optional)
No response
Suggestion to fix the issue (optional)
Replace spl_object_hash with spl_object_id
References (optional)
https://www.php.net/releases/8.6/en.php#deprecations-and-bc-breaks
Do you have anything more you want to share? (optional)
No response
Have you searched in our Wiki before posting ?
- I have searched over the Wiki
Activity