Commit 1c9915e
fix(router): normalize Java named capture groups in route constraints (#2989)
* fix(router): normalize Java named capture groups in route constraints
A constraint containing (?<name>...) still counted as a capturing group
in $mergeRoutePattern's match-position arithmetic, silently shifting
every subsequent route variable's value on java-regex engines — and
legacy-regex engines rejected the syntax outright at match time.
Extend $nonCapturingConstraint's char-class-aware scanner to rewrite
the whole (?<name> opener to (?:, leaving lookbehinds ((?<=, (?<!) and
literals inside character classes untouched.
Fixes #2976
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>
* fix(router): address Reviewer A/B consensus findings (round 1)
- Add spec asserting Wheels.InvalidRegex is thrown at draw time when a
named-capture constraint also backreferences the name (e.g.
`(?<n>\d+)\k<n>`). After normalization the group disappears but the
`\k<n>` backref remains, so Pattern.compile() rejects it and
$compileRegex rethrows. Closes the loop on issue #2976's second
acceptance criterion from the PR description, which was previously
asserted only in the changelog.
- Replace the unnecessary `##` escape in the existing `(issue ##2976)`
comment with a single `#`. CFML's `#` sigil is special only in
double-quoted strings and output contexts; in `//` comments inside
a script-mode cfc it is a literal character, so `##2976` rendered
as two hash signs in IDEs, git output, and GitHub diffs.
Cosmetic and test-only — no production code change.
Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
* fix(router): address Reviewer A/B consensus findings (round 2)
Remove the `local.` prefix from `constraintMapper` in the backref
fail-fast spec (`vendor/wheels/tests/specs/mapperModernSpec.cfc`
lines 407 and 417). Each anonymous closure has its own `local`
scope on Adobe CF, so `local.constraintMapper` inside the
`expect(function() { ... })` closure was unbound and would throw an
undefined-variable error before `whereMatch` could fail with
`Wheels.InvalidRegex`, defeating the spec. The unscoped assignment
goes to the CFC-level `variables` scope, which inner closures
inherit — the same pattern used by the sister "invalid regex throws
at draw time" spec just above (line 341). Reference: CLAUDE.md
Anti-Pattern 10.
Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
* chore(docs): move changelog entry to changelog.d fragment
Eliminates the [Unreleased]-anchor merge conflicts across campaign PRs;
fragments are assembled into CHANGELOG.md at release promotion.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.com>
---------
Signed-off-by: Peter Amiri <peter@alurium.com>
Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>1 parent d654586 commit 1c9915e
3 files changed
Lines changed: 76 additions & 8 deletions
File tree
- changelog.d
- vendor/wheels
- tests/specs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
174 | 192 | | |
175 | 193 | | |
176 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
372 | 421 | | |
373 | 422 | | |
374 | 423 | | |
| |||
0 commit comments