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

HHVM failing to parse some valid data: URI #6354

Open
dunglas opened this issue Oct 10, 2015 · 7 comments
Open

HHVM failing to parse some valid data: URI #6354

dunglas opened this issue Oct 10, 2015 · 7 comments

Comments

@dunglas
Copy link

dunglas commented Oct 10, 2015

With PHP:

php > echo file_get_contents('data:text/plain;charset=utf-8;base64,SGVsbG8gV29ybGQh');
Hello World!

With HHVM:

hphpd> echo file_get_contents('data:text/plain;charset=utf-8;base64,SGVsbG8gV29ybGQh');
echo file_get_contents('data:text/plain;charset=utf-8;base64,SGVsbG8gV29ybGQh');

Warning: rfc2396: invalid parameter
@r3wt
Copy link

r3wt commented Oct 10, 2015

Isn't that a bit ridiculous? Just because PHP lets you do comepletely redundant things doesn't mean hhvm should as well.

@dunglas
Copy link
Author

dunglas commented Oct 10, 2015

This is not related to PHP. Similar URIs are used in the wild (and it's how I found this problem first).

@r3wt
Copy link

r3wt commented Oct 10, 2015

Does it choke with base64_decode as well?

@SiebelsTim
Copy link
Contributor

It chokes on the charset. When you remove the charset it works fine.

@dunglas
Copy link
Author

dunglas commented Oct 10, 2015

Yes the problem is only the charset.

@jwatzman
Copy link
Contributor

https://3v4l.org/VmPKS

@lexidor
Copy link
Collaborator

lexidor commented Aug 27, 2023

The rfc to cite is 2397. The hhvm error message threw me to 2396. Adding a charset this way is spec compliant.

The data Uri parser in hhvm is (maybe was) not following the spec properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants