ouzo
ouzo copied to clipboard
Shouldn't `Json::encode()` in ouzo use `JSON_UNESCAPED_SLASHES`?
echo Json::encode('5/6');
Result
"5\/6"
Why is / escaped?
If you use JSON_UNESCAPED_SLASHES from https://www.php.net/manual/en/json.constants.php, it doesn't quote slash anymore.
PS: From PHP documentation I found, that PHP json_encode() quotes /, because when you arbitrarily paste it into <script></script> (so maybe 0.01% of use-cases), then / is disallowed and malforms HTML, but that's a really weird reason, since it should be encoded with htmlentities().