Add IDN support for redirects also#2424
Conversation
|
if the corrent PR is a solution for issue #2423 then we should consider centralizing this logic.. |
|
btw I am targeting 6.5 as a bugfix. |
alexeyshockov
left a comment
There was a problem hiding this comment.
Please see my comments related to #2448. IMO it makes sense to include a fix for it here too, because you are changing the same piece of code.
| * @return UriInterface | ||
| * @internal | ||
| */ | ||
| function _idn_uri_convert(UriInterface $uri, $options = IDNA_DEFAULT) |
There was a problem hiding this comment.
What do you think about changing IDNA_DEFAULT constant to 0 here? I'm think when intl is not available it can cause an error...
See roundcube/roundcubemail#6244 for details, also related to #2448.
| function _idn_uri_convert(UriInterface $uri, $options = IDNA_DEFAULT) | ||
| { | ||
| if ($uri->getHost()) { | ||
| $asciiHost = idn_to_ascii($uri->getHost(), $options, INTL_IDNA_VARIANT_UTS46, $info); |
There was a problem hiding this comment.
It make sense to use $variant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : null; workaround here, because it seems that the constant is not always available.
|
@alexeyshockov thank you for the review.. can you check again? |
alexeyshockov
left a comment
There was a problem hiding this comment.
Still the UTS46 issue (read my comment and suggestion). Thanks a lot for your work.
| $variant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : 0; | ||
| $asciiHost = idn_to_ascii($uri->getHost(), $options, $variant, $info); |
There was a problem hiding this comment.
Just checked locally, it raises a deprecation error (idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated).
The only way is to call the function without the third argument at all, like here:
$asciiHost = defined('INTL_IDNA_VARIANT_UTS46')
? idn_to_ascii($uri->getHost(), $idnOptions, INTL_IDNA_VARIANT_UTS46, $info)
: idn_to_ascii($uri->getHost(), $idnOptions);
There was a problem hiding this comment.
OK, so it's night and too many versions to keep in the head.
It works on my machine, because I have PHP 7.4 with already right defaults.
On 7.3 it raises a warning by default, if you don't specify INTL_IDNA_VARIANT_UTS46 manually. So there is basically no way to get rid of this deprecation error in PHP 7.2+ if you have an old version of ICU library. Looks like we have to disable idn_conversion by default in this case (PHP 7.2+ and INTL_IDNA_VARIANT_UTS46 not defined).
There was a problem hiding this comment.
better we avoid the back and forth :)
There was a problem hiding this comment.
Agree, but now it seems really out of scope here
|
So, how does this relate to #2454 ? Should the two be shipped in 6.5.1? |
Initially (when the issue with So the last changes (connected to
Don't see reasons not to do that. Or ship #2454 first and this one after, in |
|
Thanks @alexeyshockov ! If @gmponos can make the required changes we can release these fixes together. |
|
I will later today or tomorrow... |
|
@alexeyshockov I merged your changes from 6.5 branch. Would appreciate if you could re-validate this. |
alexeyshockov
left a comment
There was a problem hiding this comment.
Thank you for this fix, looks good
|
@gmponos Can you please enable the intl extension in GH actions ci.yaml? I just saw that there is a condition for the intl extension being loaded. |
|
done on #2478 since current branch has tests under travis |
No description provided.