Edit report at https://bugs.php.net/bug.php?id=81616&edit=1
ID: 81616
Comment by: gblanchet at cofomo dot com
Reported by: gblanchet at cofomo dot com
Summary: curl should be build against libidn2
Status: Open
Type: Feature/Change Request
Package: cURL related
Operating System: Windows
PHP Version: 8.0.12
Block user comment: N
Private report: N
New Comment:
As I understand, building with MSVC will use IdnMapping function in Windows which is IDNA2003
compliant. Surprisingly, Microsoft .net core seems to have the same issue: it is compliant with 2008
only on Linux:
https://github.com/dotnet/runtime/issues/30086
I think this is thus a Windows issue, I'm sorry I opened it in the wrong place, maybe you can
close this bug until they fix it on their side.
Previous Comments:
------------------------------------------------------------------------
[2021-11-15 19:44:08] cmb@php.net
Well, that makefile is for MinGW, but we're building with MSVC,
and there is nothing about libidn(2) in the respective
makefile[1]. But even if it was, someone would need to port
libidn2[2] to Windows MSVC; from a quick glance it appears they
are only supporting autotools builds. But even if all that was
possible, it might not be working smoothly with other Win APIs.
Still, I agree, something to consider.
[1] <https://github.com/curl/curl/blob/master/winbuild/Makefile.vc>
[2] <https://gitlab.com/libidn/libidn2>
------------------------------------------------------------------------
[2021-11-15 19:11:59] gblanchet at cofomo dot com
Thanks for the quick response. I agree, apparantely, cURL uses IDNA2003 on the Windows platform:
https://github.com/curl/curl/blob/master/docs/URL-SYNTAX.md#idna
But it seems to be possible to give the flag USE_LIBIDN2 to compile it with libidn2 even on Windows:
https://github.com/curl/curl/blob/3bf54f90f3875062c0aa984cb90ddd35565d01cd/docs/examples/Makefile.m32#L347
This change should be considered since the IDNA2003 protocol is deprecated and some url won't
work anymore.
Thanks a lot
------------------------------------------------------------------------
[2021-11-12 14:28:00] cmb@php.net
Oh, forgot to link to our configure line:
<https://github.com/winlibs/winlib-builder/blob/8167993484d58b390d93f26f660953d9fec59875/.github/workflows/curl.yml#L46>
------------------------------------------------------------------------
[2021-11-12 14:11:08] cmb@php.net
As far as I know, only Windows IDN APIs are supported on
Windows[1]. These are not disabled for our builds (there is an
apparently erroneous USE_IDN=yes, but since ENABLE_IDN defaults to
yes, that shouldn't be an issue).
So there's nothing we can do.
[1] <https://github.com/curl/curl/blob/master/winbuild/README.md?plain=1#L90-L91>
------------------------------------------------------------------------
[2021-11-12 11:43:57] gblanchet at cofomo dot com
Description:
------------
WHAT I DID:
I installed PHP8 on my Windows machine using binaries from https://windows.php.net/download
WHAT I WANTED TO HAPPEN:
I wanted to use the cURL extension to query an IDN hostname.
WHAT ACTUALLY HAPPENED:
I realized cURL was using the old IDNA2003 protocol instead of the new one: IDN2008 because the
German letter "Ã" was translated to "ss" in the a-label queried. I check the
curl_version() and I found the cause: on Windows, PHP8 seems to be bundled with libidn instead of
libidn2. Please ensure the cURL extension is compiled with libidn2 instead of libidn to generate the
Windows binaries.
Test script:
---------------
php > var_dump(curl_version());
php shell code:1:
array(16) {
[...]
'version' =>
string(6) "7.76.1"
[...]
'libidn' =>
string(0) ""
[...]
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81616&edit=1