Closed cerlestes closed 8 years ago
I've created two pull requests now. #8 is backwards-compatible and just adds more checks to the current code. #7 is a breaking change, that modifies the public API (one constant removed, one exception removed) and removes unnecessary (and bad-quality) code.
The above code will fail with the following exception:
This is not a punycode string
This is because it's pushing every domain part into Punycode::decode(), which will raise the aforementioned exception when the provided string (
bar
in this case) is not punycoded.Imho
parse_url()
shouldn't be used within thedecode()
method. There should be a separatedecodeUri()
method, to reflect how encoding is handled. And of course the exception must be handled within theIdnaConvert
class, i.e. just ignoring it and using the input string.