Respect / Validation

The most awesome validation engine ever created for PHP
https://respect-validation.readthedocs.io
MIT License
5.76k stars 774 forks source link

Use `json_validate` in `Rules\Json` if available #1394

Closed Ayesh closed 1 year ago

Ayesh commented 1 year ago

json_validate function added in PHP 8.3 validates a given string input to contain valid JSON without decoding it in memory.

This adds a function availability check to Rules\Json, and uses the new function instead of decoding the given input, followed by a last-error check.

nickl- commented 1 year ago

This is a valid patch...keeping open for reference if for nothing else

Ayesh commented 1 year ago

Thank you. I accidentally deleted my fork, but I'm available to make any further changes if necessary.

nickl- commented 1 year ago

Thank you. I accidentally deleted my fork, but I'm available to make any further changes if necessary.

I figured as much =)

The diff is still working and it is a simple enough addition. I don't want to have you make more effort because I don't know when someone will be available to merge this. Thank you for your patience.

alganet commented 1 year ago

This will be included in the (tentatively) release 2.2.4! Thanks @Ayesh and @nickl- for keeping things going.