Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Commit05071a4
committed
bug#30013 [Routing] dont redirect routes with greedy trailing vars with no explicit slash (nicolas-grekas)
This PR was merged into the 4.1 branch.Discussion----------[Routing] dont redirect routes with greedy trailing vars with no explicit slash| Q | A| ------------- | ---| Branch? | 4.1| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#29673#29734#29575| License | MIT| Doc PR | -From the linked issue:> The current logic is the following:> - when a route is declared with a trailing slash, the trimmed-slash url is redirected to the one with the slash> - when a route is declared with *no* trailing slash, the slashed url is redirected to the trimmed-slash one>> That includes routes with slash-greedy requirements: when the same greedy requirement matches both the slashed and the trimmed-slash URLs, only one of them is considered the canonical one and a redirection happens.>> We could fine tune this logic and make an exception when a trailing slash-greedy requirement is declared with no explicit trailing slash after it. (ie disable any redirections for `/foo/{.*}` but keep it for `/foo/{.*}/`. That would mean `/foo/bar` and `/foo/bar/` wouldn't trigger the redirection for route `/foo/{.*}`, breaking the "not-semantics" property of trailing slashes for catch-all routes. Which might be legit afterall.This PR implements this fine tuning, as that's the most BC behavior (and thus the correct one).See#30012 for `testGreedyTrailingRequirement` in action on 3.4 as a proof.Commits-------2bb8890 [Routing] dont redirect routes with greedy trailing vars with no explicit slashFile tree
13 files changed
+80
-213
lines changed- src/Symfony/Component/Routing
- Matcher
- Dumper
- Tests/Fixtures/dumper
13 files changed
+80
-213
lines changedLines changed: 8 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
558 | 558 | | |
559 | 559 | | |
560 | 560 | | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | 561 | | |
568 | | - | |
| 562 | + | |
| 563 | + | |
569 | 564 | | |
570 | 565 | | |
571 | 566 | | |
572 | 567 | | |
| 568 | + | |
573 | 569 | | |
574 | 570 | | |
575 | 571 | | |
576 | 572 | | |
577 | 573 | | |
578 | 574 | | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
| 575 | + | |
586 | 576 | | |
587 | 577 | | |
588 | 578 | | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
589 | 582 | | |
590 | 583 | | |
591 | 584 | | |
| |||
665 | 658 | | |
666 | 659 | | |
667 | 660 | | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | 661 | | |
686 | 662 | | |
687 | 663 | | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
| 664 | + | |
693 | 665 | | |
694 | 666 | | |
695 | 667 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
| 159 | + | |
166 | 160 | | |
167 | | - | |
| 161 | + | |
168 | 162 | | |
169 | 163 | | |
170 | 164 | | |
171 | | - | |
172 | | - | |
173 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
174 | 171 | | |
175 | 172 | | |
176 | 173 | | |
| |||
Lines changed: 8 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
| 190 | + | |
195 | 191 | | |
196 | 192 | | |
197 | 193 | | |
| |||
209 | 205 | | |
210 | 206 | | |
211 | 207 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 208 | + | |
217 | 209 | | |
218 | 210 | | |
219 | 211 | | |
| |||
225 | 217 | | |
226 | 218 | | |
227 | 219 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
| 220 | + | |
233 | 221 | | |
234 | 222 | | |
235 | 223 | | |
| |||
262 | 250 | | |
263 | 251 | | |
264 | 252 | | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
271 | 256 | | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
| 257 | + | |
| 258 | + | |
276 | 259 | | |
277 | 260 | | |
278 | 261 | | |
| |||
Lines changed: 5 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2794 | 2794 | | |
2795 | 2795 | | |
2796 | 2796 | | |
2797 | | - | |
2798 | | - | |
2799 | | - | |
2800 | | - | |
2801 | | - | |
2802 | | - | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
2803 | 2800 | | |
2804 | | - | |
2805 | | - | |
2806 | | - | |
2807 | | - | |
| 2801 | + | |
| 2802 | + | |
2808 | 2803 | | |
2809 | 2804 | | |
2810 | 2805 | | |
| |||
Lines changed: 6 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
| 122 | + | |
| 123 | + | |
130 | 124 | | |
131 | 125 | | |
132 | 126 | | |
133 | | - | |
134 | | - | |
135 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
136 | 131 | | |
137 | 132 | | |
138 | 133 | | |
| |||
Lines changed: 5 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
73 | 70 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 71 | + | |
| 72 | + | |
78 | 73 | | |
79 | 74 | | |
80 | 75 | | |
| |||
Lines changed: 2 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 47 | + | |
52 | 48 | | |
53 | 49 | | |
54 | 50 | | |
| |||
58 | 54 | | |
59 | 55 | | |
60 | 56 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 57 | + | |
66 | 58 | | |
67 | 59 | | |
68 | 60 | | |
| |||
Lines changed: 11 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
| 233 | + | |
238 | 234 | | |
239 | 235 | | |
240 | 236 | | |
| |||
252 | 248 | | |
253 | 249 | | |
254 | 250 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
| 251 | + | |
| 252 | + | |
271 | 253 | | |
272 | 254 | | |
273 | 255 | | |
| |||
278 | 260 | | |
279 | 261 | | |
280 | 262 | | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
| 263 | + | |
| 264 | + | |
297 | 265 | | |
298 | 266 | | |
299 | 267 | | |
| |||
325 | 293 | | |
326 | 294 | | |
327 | 295 | | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
| 296 | + | |
| 297 | + | |
336 | 298 | | |
337 | 299 | | |
338 | 300 | | |
339 | | - | |
340 | | - | |
341 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
342 | 305 | | |
343 | 306 | | |
344 | 307 | | |
| |||
Lines changed: 5 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
93 | 90 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 91 | + | |
| 92 | + | |
98 | 93 | | |
99 | 94 | | |
100 | 95 | | |
| |||
0 commit comments
Comments
(0)