Skip to content

Comments

Fix attribute parser#38

Merged
ganyicz merged 1 commit intomainfrom
filip/fix-attribute-parser
Feb 19, 2026
Merged

Fix attribute parser#38
ganyicz merged 1 commit intomainfrom
filip/fix-attribute-parser

Conversation

@ganyicz
Copy link
Collaborator

@ganyicz ganyicz commented Feb 19, 2026

The scenario

Quotes inside Blade echo expressions break attribute parsing:

<x-button x-text="'{{ __("Print") }}'" />

The problem

Both the Tokenizer and the AttributeParser use quote tracking to determine attribute boundaries.

The quotes inside {{ }} toggle the quote state mid-value:

x-text="'{{ __("Print") }}'"
       ^       ^

The parser thinks the quoted string ended early, breaking the attribute in half.

The solution

Treat Blade echo expressions ({{ }} and {!! !!}) as opaque tokens in both places:

  • Tokenizer::collectAttributes() — consume entire expressions without updating quote state.
  • AttributeParser::parseAttributeStringToArray() — shield expressions with placeholders before regex parsing.

@ganyicz ganyicz merged commit 0b5f393 into main Feb 19, 2026
6 checks passed
@ganyicz ganyicz deleted the filip/fix-attribute-parser branch February 19, 2026 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant