ouzo icon indicating copy to clipboard operation
ouzo copied to clipboard

Shouldn't `Json::encode()` in ouzo use `JSON_UNESCAPED_SLASHES`?

Open danon opened this issue 4 years ago • 0 comments

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().

danon avatar Mar 25 '21 20:03 danon