Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
danon opened this issue Mar 25, 2021 · 0 comments
Open

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

danon opened this issue Mar 25, 2021 · 0 comments

Comments

@danon
Copy link
Member

danon commented Mar 25, 2021

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

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

No branches or pull requests

1 participant