Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Yaml] Fix parsing inline anchored values#64388

Merged
nicolas-grekas merged 1 commit into
symfony:6.4symfony/symfony:6.4from
nicolas-grekas:yaml-anchor-inline-fix-6.4nicolas-grekas/symfony:yaml-anchor-inline-fix-6.4Copy head branch name to clipboard
May 28, 2026
Merged

[Yaml] Fix parsing inline anchored values#64388
nicolas-grekas merged 1 commit into
symfony:6.4symfony/symfony:6.4from
nicolas-grekas:yaml-anchor-inline-fix-6.4nicolas-grekas/symfony:yaml-anchor-inline-fix-6.4Copy head branch name to clipboard

Conversation

@nicolas-grekas
Copy link
Copy Markdown
Member

@nicolas-grekas nicolas-grekas commented May 28, 2026

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #64363
License MIT

Parsing inline YAML like { foo: &1 "FOO", bar: *1 } returned the value with surrounding quotes ('"FOO"') instead of unescaping the quoted scalar, and { foo: &1 "${FOO}", bar: *1 } failed with Malformed inline YAML string because the { inside the quoted value broke the lexer.

Two issues combined:

  1. The lexer's lexUnquotedString did not recognize & and * as anchor/alias indicators, so it greedily consumed &NAME "value and broke at the { of \${FOO}.
  2. The inline parser treated &NAME "value" as a single plain scalar; REFERENCE_PATTERN just captured the literal substring after the anchor name, so quotes and other value types were never parsed.

This adds a dedicated &/* token in lexInlineStructure, and a parseAnchor helper in Inline that extracts the anchor name before dispatching to the matching value parser (sequence/mapping/scalar). The fix also covers anchored sequences, mappings, and merge keys.

Properly parse the value following an anchor in inline mappings and
sequences instead of consuming it as part of a plain scalar. The lexer
now tokenizes anchors and aliases as their own units, and the inline
parser dispatches to the matching value parser after extracting the
anchor name.
@nicolas-grekas nicolas-grekas requested a review from xabbuh as a code owner May 28, 2026 13:38
@carsonbot carsonbot added this to the 6.4 milestone May 28, 2026
@nicolas-grekas nicolas-grekas merged commit f10a24d into symfony:6.4 May 28, 2026
11 of 13 checks passed
@fabpot fabpot mentioned this pull request May 29, 2026
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.