-
Notifications
You must be signed in to change notification settings - Fork 185
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
Support for HHVM #62
Comments
I'm fine adding a check for |
I am not sure if ENT_SUBSTITUTE will be a usefull parameter. If there is much binary data in the query, it will be encoded instead of skipped. What about switching to htmlspecialchars? It will not output "Ã" instead of "Ã "what htmlentities does. |
ok, so to fix this, we would need to switch to htmlspecialchars and add an extra if statement to check for ENT_SUBSTITUTE support? I'm not sure I would do this just for a HHVM bug, which will probably be fixed soon. Would this provide any benefit to normal PHP usage? I don't know too much about character encodings. |
I dont think there is a quick but lasting fix here. There is also a hint we should look at here:
Summarized, we could leave everything as is and skip HHVM testing. My opinion is, to switch to 'htmlspecialchars' and release this change as a 1.3.* version. |
Lost me there. Does not matter UTF8 or Latin1, you do not want to emit a naked & in HTML because that is invalid HTML. Ditto < and >. Per W3C: Sure only htmlspecialchars() is sufficient for valid html, but a lot of programmers use htmlentities() to make their HTML more robust and readable, even in a UTF8 environment. Sadly, since htmlspecialchars() is currently broken in hhvm using it instead of htmlentitities() still leaves brokenness. Regardless of the arguments pro or con, the goal should be to duplicate existing PHP behavior, not to rethink it. |
In the end it is not critical, because this library works on HHVM as expected. Just the tests will not run exactly the same because of this one different behaviour. Lets see what the future brings.
HHVM will create html entites for "<>&" as intended. It will just not create html entites for "Ãà...". |
Uh, no. I expect it to work as in the PHP documentation. See HHVM bug #2061
Uh, no, see HHVM bug #2064 |
In case somebody else tries to add support for HHVM, this is the current state:
There is currently a problem with some test with unicode caracters:
https://travis-ci.org/h4cc/sql-formatter/jobs/20499499
Cause is the htmlentities function, which does not encode unicode characters with corresponding entities:
facebook/hhvm#1875
A solution could be replacing htmlentities with htmlspecialchars.
But even there is a small bug, because using ENT_IGNORE will simple skip all non ASCII chars:
facebook/hhvm#2071
Example:
Output:
But this should be solveable by switching to ENT_SUBSTITUTE.
@jdorn What do you think? Waiting for a HHVM fix or using htmlspecialchars with ENT_SUBSTITUTE?
The text was updated successfully, but these errors were encountered: