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

url encoding #56

Open
ts65 opened this issue Jul 5, 2022 · 2 comments
Open

url encoding #56

ts65 opened this issue Jul 5, 2022 · 2 comments

Comments

@ts65
Copy link

ts65 commented Jul 5, 2022

Currently the library uses urlencode/urldecode. Could you change it to use rawurlencode/rawurldecode so it encodes spaces as %20 and not +? Since 7.4.3 PHP uses %20 and it would be more consistent with it's setcookie function and $_COOKIE doesn't decode the +. I need to set a cookie that is compatible with that.

@linuxd3v
Copy link

Ouchie. im in the same boat.
interestingly swoole/openswoole uses urlencode as well: https://openswoole.com/docs/modules/swoole-http-response-cookie

this is specifically an issue if one does base64 encode before setting cookie - as it uses + character as well.

@ts65
if you use base64 - you could safeguard your data like this instead - it doesnt use + char:
sodium_base642bin($base64String, SODIUM_BASE64_VARIANT_URLSAFE);
sodium_bin2base64($binaryString, SODIUM_BASE64_VARIANT_URLSAFE);

@ts65
Copy link
Author

ts65 commented Aug 19, 2022

@linuxd3v Unfortunately I have control over one part (creating the cookie) but not the other (consuming the cookie), so I can't use base64 encoding since it wouldn't be decoded. But yes, if someone can do it, it would help.

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

2 participants