Skip to content

[14.x] Fix forgetting an array of keys on the memoized tagged cache - #61881

Merged
taylorotwell merged 1 commit into
laravel:masterfrom
GabeSilvaDev:fix/memo-tagged-forget-array
Oct 6, 2026
Merged

taylorotwell merged 1 commit into
laravel:masterfrom
GabeSilvaDev:fix/memo-tagged-forget-array

Conversation

@GabeSilvaDev

Copy link
Copy Markdown
Contributor

#61466 made Cache::forget() accept an array of keys, but MemoizedTaggedCache overrides forget() and still treats the key as a string, so passing an array throws:

Cache::memo()->tags(['foo', 'bar'])->forget(['name.0', 'name.1']);

// ErrorException: Array to string conversion
// at MemoizedTaggedCache.php:250

Nothing is removed. pull() with an array fails the same way, since it calls forget() with the same keys.

This mirrors Repository::forget(): when the key is an array it goes through deleteMultiple(), which calls forget() for each key, so both the tagged entry and the memoized copy are cleared.

The new test in MemoizedTaggedCacheTest fails with the exception above without the change. I ran that file against a local Redis.

Copilot AI balanced review requested due to automatic review settings October 5, 2026 16:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@taylorotwell
taylorotwell merged commit 571c3c6 into laravel:master Oct 6, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants