1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-09-01 01:01:46 +02:00

Fix: isJSON now returns false for empty strings

This commit is contained in:
Daniel St. Jules
2015-09-09 21:24:11 -07:00
parent c5f370c46d
commit 4673754054
3 changed files with 17 additions and 3 deletions

View File

@@ -527,7 +527,9 @@ s('A102F')->isHexadecimal(); // true
##### isJson()
Returns true if the string is JSON, false otherwise.
Returns true if the string is JSON, false otherwise. Unlike json_decode
in PHP 5.x, this method is consistent with PHP 7 and other JSON parsers,
in that an empty string is not considered valid JSON.
```php
s('{"foo":"bar"}')->isJson(); // true