Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use next instead of break; avoid terminating whole loop #27499

Merged
merged 1 commit into from
Dec 29, 2016

Conversation

maclover7
Copy link
Contributor

Summary

We want to avoid terminating the whole loop here, because it will cause
parameters that should be removed to not be removed, since we are
terminating early. In this specific case, param2 is processed before
param1 due to the reversing of route.parts, and since param2 fails
the check on this line, it would previously cause the whole loop to
fail, and param1 would still be in parameterized_parts. Now, we are
simply calling next, which is the intended behavior.

Other Information

Introduced by 8ca8a2d.

Fixes #27454.

We want to avoid terminating the whole loop here, because it will cause
parameters that should be removed to not be removed, since we are
terminating early. In this specific case, `param2` is processed before
`param1` due to the reversing of `route.parts`, and since `param2` fails
the check on this line, it would previously cause the whole loop to
fail, and `param1` would still be in `parameterized_parts`. Now, we are
simply calling `next`, which is the intended behavior.

Introduced by 8ca8a2d.

Fixes rails#27454.
@rafaelfranca
Copy link
Member

Backported in a7d512e

rafaelfranca added a commit that referenced this pull request Dec 29, 2016
Use `next` instead of `break`; avoid terminating whole loop
@maclover7 maclover7 deleted the jm-fix-27454 branch December 29, 2016 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants