10000 bug #42835 [Cache] Fix implicit float to int cast (derrabus) · symfony/symfony@1e2bf5d · GitHub
[go: up one dir, main page]

Skip to content

Commit 1e2bf5d

Browse files
committed
bug #42835 [Cache] Fix implicit float to int cast (derrabus)
This PR was merged into the 4.4 branch. Discussion ---------- [Cache] Fix implicit float to int cast | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Part of #41552 | License | MIT | Doc PR | N/A Passing a float to a method that expects an integer triggers a deprecation on PHP 8.1 if that implicit float to int cast would mean a loss of precision. This PR fixes such an error in the cache component by making sure an integer is passed. This fixes an error in our 5.3 CI. Commits ------- 93f27d9 Fix implicit float to int cast
2 parents cac85b3 + 93f27d9 commit 1e2bf5d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Cache/Adapter/AbstractAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public static function createSystemCache($namespace, $defaultLifetime, $version,
121121
return $opcache;
122122
}
123123

124-
$apcu = new ApcuAdapter($namespace, (int) $defaultLifetime / 5, $version);
124+
$apcu = new ApcuAdapter($namespace, intdiv($defaultLifetime, 5), $version);
125125
if (null !== $logger) {
126126
$apcu->setLogger($logger);
127127
}

0 commit comments

Comments
 (0)
0