Repository navigation
[6.x] Give each Stache traversal its own filter - #15551
Merged
jasonvarga merged 1 commit intoSep 30, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016o2kMZ4DZaNGJ4pUqPov7D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15550.
References #10410
Every Stache store shares one
Traverser, becauseStoreandTaxonomyTermsStorereach it through a real-time facade, whose resolved instance Laravel caches.filter()stored the callback on that shared instance, andtraverse()reads it again for each file. So when a store's filter starts another traversal partway through the loop, which happens on multisite whenCollectionEntriesStore::getItemFilter()resolves the collection against a cold cache, the running traversal carries on with the other store's filter. The entries store then keeps only its first file and caches that as its paths.This makes
filter()return a clone that carries the callback, so each traversal keeps its own filter. All three core call sites (Store.php:193,Store.php:309andTaxonomyTermsStore.php:166) already chainfilter()->traverse(), so they are unaffected.Tests, both of which fail without the fix:
filtering_does_not_change_the_filter_of_the_original_instanceapplies two filters to one traverser and checks that each result has its own filter and the original has none.a_traversal_started_by_a_filter_does_not_replace_the_running_traversals_filtersets up a multisite collection with three entries on a cold Stache and asserts that the entries store's paths contain all three. On6.xit returns one.Code that calls
Traverser::filter()andTraverser::traverse()as two separate facade calls, relying on the filter persisting between them, would no longer be filtered. Core doesn't do this. If that's a concern, the alternatives are:traverse()as an optional argument and have the stores use that. This is the most explicit option, but it changes the method signature.Traverserfor each traversal.