php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #81616 curl should be build against libidn2
Submitted: 2021-11-12 11:43 UTC Modified: 2021-11-15 19:44 UTC
From: gblanchet at cofomo dot com Assigned:
Status: Open Package: cURL related
PHP Version: 8.0.12 OS: Windows
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2021-11-12 11:43 UTC] 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) ""
  [...]
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-12 14:11 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Package: *Unicode Issues +Package: cURL related -Assigned To: +Assigned To: cmb
 [2021-11-12 14:11 UTC] 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-15 19:11 UTC] 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-15 19:44 UTC] cmb@php.net
-Summary: Windows binaries comes by default with libidn instead of libidn2 +Summary: curl should be build against libidn2 -Status: Not a bug +Status: Open -Type: Bug +Type: Feature/Change Request -Assigned To: cmb +Assigned To:
 [2021-11-15 19:44 UTC] 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 20:42 UTC] gblanchet at cofomo dot com
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.
 [2021-11-16 21:20 UTC] gblanchet at cofomo dot com
I log a bug for this in the Windows sdk:

https://github.com/tpn/winsdk-10/issues/5
 [2021-11-16 21:24 UTC] gblanchet at cofomo dot com
Sorry, wrong repo, ignore my previous comment
 [2022-12-07 07:26 UTC] Leonard5632anya at gmail dot com
(https://www.pfmlogin.org/)github.com

We therefore see the following in the config log:
    ...
    checking whether to build with libidn2... (assumed) yes
    ...
    checking for libidn2 options with pkg-config... no
    configure: IDN_LIBS: "-lidn2"
    configure: IDN_LDFLAGS: ""
    configure: IDN_CPPFLAGS: ""
    configure: IDN_DIR: ""
    checking if idn2_lookup_ul can be linked... yes
    checking idn2.h usability... yes
    checking idn2.h presence... yes
    checking for idn2.h... yes
 [2022-12-19 09:05 UTC] barrykaao at gmail dot com
Thanks for sharing such great information, the post you published have some great information which is quite beneficial for me. I highly appreciated with your work abilities. (https://www.baycare-patientportal.com/)github.com
 [2022-12-28 11:25 UTC] Jason1976Kees at gmail dot com
Therefore, curl unconditionally tries to build against libidn2,
which in particular is a problem for curl-native, as that might
or might not build against the build-machine's libidn2 now,
which furthermore causes problems when trying to share sstate
between multiple build machines

(https://www.nextemployeeportal.com/)github.com
 [2023-01-05 05:31 UTC] marlynrasavong at gmail dot com
Everything is very open with a clear description of the issues. It was truly informative.(https://www.checkmyrota.org/)github.com
 [2023-01-06 07:00 UTC] delhifilmy at gmail dot com
Thanks for sharing such great information, the post you published have some great information which is quite beneficial for me. I highly appreciated with your work abilities. (https://www.delhifilminstitute.com/next-employee-portal-login-at-employee-next-co-uk.html)github.com
 [2023-01-30 08:29 UTC] brandencaufield at gmail dot com
Did you have a fix on this issue? Facing same issue but no response from anyone and couldn't find this topic troubleshooting in google. (https://apps.apple.com/us/app/dinar-guru-dinarguru-app/id1581089419)github.com
 [2023-04-08 09:29 UTC] yobecom359 at marikuza dot com
Great Article thanks for such great information please do follow these articles. we care rite and  https://github.com/yobecom359
 [2023-04-17 12:40 UTC] parenokiro at proton dot me
tdrgtuy
 [2023-06-30 10:01 UTC] richardfoxmx63577 at gmail dot com
This great info (https://github.com/Structure.php)(https://www.yourtexasbenefits.bid/)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 18:01:28 2024 UTC