Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Cache] ArrayAdapter serialization exception clean $expiries#60122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 2 commits intosymfony:6.4frombastien-wink:master
Apr 7, 2025

Conversation

bastien-wink
Copy link
Contributor

@bastien-winkbastien-wink commentedApr 2, 2025
edited by nicolas-grekas
Loading

QA
Branch?6.4
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix#60121
LicenseMIT

InArrayAdapter.php:339, if $value contains a Closure, an Exception is triggered and $this->values get cleaned.

  try {      $serialized = serialize($value);  } catch (\Exception $e) {      unset($this->values[$key], $this->expiries[$key], $this->tags[$key]);      $type = get_debug_type($value);      $message = \sprintf('Failed to save key "{key}" of type %s: %s', $type, $e->getMessage());      CacheItem::log($this->logger, $message, ['key' => $key, 'exception' => $e, 'cache-adapter' => get_debug_type($this)]);      return null;  }

$this->expiries is used inArrayAdapter.php:300 to determine cache hit. If hash is found in $this->expiries but missing in $this->keys it generate a NOTICE.

On serialize($value); catch Exception, clean expiries with unset.

@carsonbotcarsonbot added this to the7.3 milestoneApr 2, 2025
@carsonbotcarsonbot changed the titlebug #60121[Cache] ArrayAdapter serialization exception clean $expiries[Cache] bug #60121 ArrayAdapter serialization exception clean $expiriesApr 2, 2025
@stof
Copy link
Member

stof commentedApr 2, 2025

Please add a test to prevent regressions

bastien-wink and OskarStark reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas changed the title[Cache] bug #60121 ArrayAdapter serialization exception clean $expiries[Cache] ArrayAdapter serialization exception clean $expiriesApr 4, 2025
@nicolas-grekasnicolas-grekas modified the milestones:7.3,6.4Apr 4, 2025
@nicolas-grekasnicolas-grekas changed the base branch from7.3 to6.4April 4, 2025 08:20
@nicolas-grekasnicolas-grekas changed the base branch from6.4 to7.3April 4, 2025 08:20
@nicolas-grekas
Copy link
Member

Thank you@bastien-wink.

@nicolas-grekasnicolas-grekas merged commit196c99e intosymfony:6.4Apr 7, 2025
8 of 11 checks passed
nicolas-grekas added a commit that referenced this pull requestApr 8, 2025
…dapter (nicolas-grekas)This PR was merged into the 6.4 branch.Discussion----------[Cache] Fix invalidating on save failures with Array|ApcuAdapter| Q             | A| ------------- | ---| Branch?       | 6.4| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Issues        | -| License       | MITI merged#60122 and then realized it was fixing a bad behavior. Saving an invalid key should not remove the previous one, if any.Commits-------30640b2 [Cache] Fix invalidating on save failures with Array|ApcuAdapter
This was referencedMay 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@lyrixxlyrixxAwaiting requested review from lyrixx

@ycerutoycerutoAwaiting requested review from yceruto

@chalasrchalasrAwaiting requested review from chalasr

@dunglasdunglasAwaiting requested review from dunglas

@OskarStarkOskarStarkAwaiting requested review from OskarStark

@jderussejderusseAwaiting requested review from jderusse

@xabbuhxabbuhAwaiting requested review from xabbuh

Assignees
No one assigned
Projects
None yet
Milestone
6.4
Development

Successfully merging this pull request may close these issues.

[Cache] ArrayAdapter serialization exception does not clean $expiries
4 participants
@bastien-wink@stof@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp