Skip to content

Commit

Permalink
fix(CachingObjectMappingResolver): Safeguard
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed Jan 17, 2024
1 parent d7ed061 commit 4eb4bb5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* perf: Optimize `Context` & `ObjectCache`
* perf: Change 'simpletypes' cache to array.
* perf: Use our `PropertyAccessLite` instead of Symfony's.
* fix(`CachingObjectMappingResolver`): Safeguard

## 0.5.14

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ public function resolveObjectMapping(
$cacheItem = $this->cacheItemPool->getItem($cacheKey);

if ($cacheItem->isHit()) {
/** @var mixed */
$cached = $cacheItem->get();
try {
/** @var mixed */
$cached = $cacheItem->get();

if ($cached instanceof ObjectMapping) {
return $this->cache[$cacheKey] = $cached;
if ($cached instanceof ObjectMapping) {
return $this->cache[$cacheKey] = $cached;
}
} catch (\Throwable) {
}

unset($this->cache[$cacheKey]);
Expand Down

0 comments on commit 4eb4bb5

Please sign in to comment.