Skip to content

Conversation

@daun
Copy link

@daun daun commented Jul 9, 2025

  • 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
Copy link

manojhl commented Sep 3, 2025

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
Copy link

mtozzo commented Oct 5, 2025

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