Instrument usage of bug with iteration of String with offset or 0 limit #1667
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.
Problem
Looks like 01dea94 introduced a bugs from trying to preserve ruby 1.8.7 behaviour. One that I think seems worth trying to fix is the special case of the limit and offset not applying to a String, which seems like enough of an edge case that it may not be used in practice.
The other regression from that commit demonstrates how little usage there was of String iteration at the time, since in ruby 1.8.7 liquid/ruby would iterate over lines of a String (i.e. String#each would split on the default separator
$/
).Solution
Use Liquid::Usage.instrument to see if any code iterates of a String with a positive offset or 0 limit. That way we can decide whether we can fix this buggy behaviour or need to preserve it for backwards compatibility.