Skip to content

Ensure number strings are treated as HTML#76

Open
daun wants to merge 2 commits into
ueberdosis:mainfrom
daun:fix/number-content
Open

Ensure number strings are treated as HTML#76
daun wants to merge 2 commits into
ueberdosis:mainfrom
daun:fix/number-content

Conversation

@daun

@daun daun commented Jul 9, 2025

Copy link
Copy Markdown
  • A pure number string like 1999 will currently be interpreted as valid JSON
  • This will fail in subsequent steps because a JSON object/array is expected, instead of the number 1999
  • This change will mark any string starting with a number as HTML going forward
  • An alternative could be to expect { or [ as first character to mark things as JSON
  • I've added a test, but can't get it to run locally because of PHP deprecations in Pest :(

@manojhl

manojhl commented Sep 3, 2025

Copy link
Copy Markdown

I agree with this change, thanks for fixing this! I also need this behavior in my projects, so looking forward to it being merged.

@mtozzo

mtozzo commented Oct 5, 2025

Copy link
Copy Markdown

I've fixed similar issues in my wrapper for this library for strings such as null and false in addition to numbers. I'm currently trying to figure out how to prevent a crash if the input is just an HTML comment such as <!-- This is a comment that should be ignored -->.

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.

3 participants