Skip to content

Commit bc67dd9

Browse files
committed
[Cache] Fixed expiry maybe int due too race conditions
1 parent 2fb61a4 commit bc67dd9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ static function ($sourceItem, $item, $sourceMetadata = null) use ($defaultLifeti
7474
$item->metadata = $item->newMetadata = $sourceItem->metadata = $sourceMetadata;
7575

7676
if (isset($item->metadata[CacheItem::METADATA_EXPIRY])) {
77-
$item->expiresAt(\DateTime::createFromFormat('U.u', $item->metadata[CacheItem::METADATA_EXPIRY]));
77+
$format = \is_int($item->metadata[CacheItem::METADATA_EXPIRY]) ? 'U' : 'U.u';
78+
$item->expiresAt(\DateTime::createFromFormat($format, $item->metadata[CacheItem::METADATA_EXPIRY]));
7879
} elseif (0 < $defaultLifetime) {
7980
$item->expiresAfter($defaultLifetime);
8081
}

0 commit comments

Comments
 (0)