Skip to content

Commit

Permalink
bug #36737 [Cache] fix accepting sub-second max-lifetimes in ArrayAda…
Browse files Browse the repository at this point in the history
…pter (nicolas-grekas)

This PR was merged into the 5.1-dev branch.

Discussion
----------

[Cache] fix accepting sub-second max-lifetimes in ArrayAdapter

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

cefa1e6 [Cache] fix accepting sub-second max-lifetimes in ArrayAdapter
  • Loading branch information
fabpot committed May 8, 2020
2 parents 070552e + cefa1e6 commit 8f58a2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/Cache/Adapter/ArrayAdapter.php
Expand Up @@ -40,10 +40,10 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
/**
* @param bool $storeSerialized Disabling serialization can lead to cache corruptions when storing mutable values but increases performance otherwise
*/
public function __construct(int $defaultLifetime = 0, bool $storeSerialized = true, int $maxLifetime = 0, int $maxItems = 0)
public function __construct(int $defaultLifetime = 0, bool $storeSerialized = true, float $maxLifetime = 0, int $maxItems = 0)
{
if (0 > $maxLifetime) {
throw new InvalidArgumentException(sprintf('Argument $maxLifetime must be a positive integer, %d passed.', $maxLifetime));
throw new InvalidArgumentException(sprintf('Argument $maxLifetime must be positive, %F passed.', $maxLifetime));
}

if (0 > $maxItems) {
Expand Down

0 comments on commit 8f58a2d

Please sign in to comment.