Skip to content

Commit 85992d2

Browse files
authored
APCU: use ttl of 0 when passed null (#250)
* APCU: use ttl of 0 when passed null Under PHP 8.1 alpha builds, a deprecation warning about invalid `$ttl` is emitted when `null` is passed: ``` PHP Deprecated: apcu_store(): Passing null to parameter #3 ($ttl) of type int is deprecated in /var/www/html/vendor/cache/apcu-adapter/ApcuCachePool.php on line 88 ``` This change fixes the issue. * Remove trailing whitespace from GH editor
1 parent 870eb6d commit 85992d2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ApcuCachePool.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ protected function storeItemInCache(PhpCacheItem $item, $ttl)
8585
return false;
8686
}
8787

88+
if ($ttl === null) {
89+
$ttl = 0;
90+
}
91+
8892
return apcu_store($item->getKey(), serialize([$item->get(), $item->getTags(), $item->getExpirationTimestamp()]), $ttl);
8993
}
9094

0 commit comments

Comments
 (0)