Skip to content
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

INTL_IDNA_VARIANT_2003 is deprecated #2620

Closed
n3omaster opened this issue Apr 20, 2020 · 38 comments
Closed

INTL_IDNA_VARIANT_2003 is deprecated #2620

n3omaster opened this issue Apr 20, 2020 · 38 comments
Milestone

Comments

@n3omaster
Copy link

Guzzle version(s) affected: 6.5.3
PHP version: 7.3.16 (hint: php --version)
cURL version: 7.69.1 (hint: php -i | grep cURL)

Description
My Telegram Bot is giving me this error when upgrade from 6.4.0 to 6.5.3:

idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated

in Utils.php line 35
at HandleExceptions->handleError(8192, 'idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated', '/home/erich33/vendor/guzzlehttp/guzzle/src/Utils.php', 35, array('uri' => object(Uri), 'options' => 0, 'idnaVariant' => 0))

How to reproduce
When somebody message to my Telegram Bot, I have a script which send to my email the Exceptions, and turns now a hell with this error.

Possible Solution
Downgrade to 6.4?
Something with symfony idn?

Additional context
My actual composer.lock:

{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.3",
"artesaos/seotools": "^0.17.1",
"binarytorch/larecipe": "^2.2",
"biscolab/laravel-recaptcha": "^4.0",
"facebook/graph-sdk": "^5.7",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.5",
"intervention/image": "^2.5",
"irazasyed/telegram-bot-sdk": "3.1.0",
"laravel-notification-channels/facebook": "^0.1.0",
"laravel-notification-channels/facebook-poster": "^2.0",
"laravel-notification-channels/telegram": "^0.3.0",
"laravel-notification-channels/twitter": "^3.0",
"laravel/framework": "^6.2",
"laravel/passport": "^8.4",
"laravel/socialite": "^4.1",
"laravel/tinker": "^2.2",
"overtrue/laravel-like": "^2.0",
"predis/predis": "^1.1",
"renatomarinho/laravel-page-speed": "^1.8",
"rennokki/befriended": "^3.0",
"rennokki/rating": "^2.0",
"spatie/laravel-permission": "^3.11",
"spatie/laravel-responsecache": "^6.3",
"spatie/laravel-sitemap": "^5.3",
"spatie/schema-org": "^2.2",
"tedivm/fetch": "^0.7.1"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.2",
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^9.0"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"files": [
"app/Helpers/Helper.php"
],
"psr-4": {
"App\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi",
"@php artisan optimize",
"@php artisan view:clear",
"@php artisan cache:clear",
"@php artisan responsecache:clear"
],
"post-root-package-install": [
"@php -r "file_exists('.env') || copy('.env.example', '.env');""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}

@GrahamCampbell
Copy link
Member

I guess this is happening on this line: https://github.com/guzzle/guzzle/blob/6.5/src/Utils.php#L33.

@GrahamCampbell
Copy link
Member

That constant should be defined, however: https://github.com/symfony/polyfill-intl-idn/blob/master/bootstrap.php#L37.

@GrahamCampbell
Copy link
Member

What extensions do you have?

@GrahamCampbell
Copy link
Member

My actual composer.lock:

That is not your lock file.

@n3omaster
Copy link
Author

Hi GrahamCampell, I just did a PHP upgrade from 7.3 to 7.4, then do a composer update and everything worked fine. Thanks!

BTW: I suposse INTL_IDNA_VARIANT_UTS46 and INTL_IDNA_VARIANT_2003 are defined on other symfony package. Thanks!

@GrahamCampbell
Copy link
Member

Guzzle should also work on PHP 7.3, so we'd like to know what was going wrong.

@spaantje
Copy link

Fyi; i'm (was) having the same issue

Guzzle version(s) affected: 6.5.3
PHP version: 7.2.30 (hint: php --version)
cURL version: 7.19.7 (hint: php -i | grep cURL)

I downgraded to 6.5.2 to fix the issue.

@GrahamCampbell
Copy link
Member

Just to clarify, do you have the intl extension installed, or not?

@spaantje
Copy link

@GrahamCampbell; intl is installed.

extension_loaded('intl'); // -> true

@spaantje
Copy link

spaantje commented Apr 22, 2020

@GrahamCampbell i think it's caused by adding the symfony/polyfill-intl-idn package and/or removing your custom check (source)

My complete error was:

production.ERROR: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated {"exception":"[object] (ErrorException(code: 0): idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated at /httpdocs/vendor/guzzlehttp/guzzle/src/Utils.php:35)

Because the package is triggering the error:
https://github.com/symfony/polyfill-intl-idn/blob/master/Idn.php#L67

Hope this helps.

If i need to test anything, please let me know!

@GrahamCampbell
Copy link
Member

Because the package is triggering the error:

Odd. That package code should never be run if the extension is loaded. Are you sure it is that line that's running, and not the same line in the C code?

@spaantje
Copy link

Hmm, you right.

The problem is; it was (and is) working fine when i use Guzzle version 6.5.2 but errors out on version 6.5.3 on: /httpdocs/vendor/guzzlehttp/guzzle/src/Utils.php:35

Maybe it's a server issue ? Do you have any idea ?

When i run the following test script:

<?php

echo "<pre>";

echo "idn_to_ascii function_exists: "; var_dump(function_exists('idn_to_ascii'));
echo "<br><br>";

$idnaVariant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : 0;
echo "idnaVariant: "; var_dump($idnaVariant);
echo "<br><br>";

echo "PHP_VERSION_ID: "; var_dump(PHP_VERSION_ID);
echo "<br><br>";

echo "idn_to_ascii test: "; var_dump(idn_to_ascii('google.com', 0));
echo "<br><br>";

echo "</pre>";

i get the following:

idn_to_ascii function_exists: bool(true)
idnaVariant: int(0)
PHP_VERSION_ID: int(70230)
idn_to_ascii test: string(10) "google.com"

(so then it does not throw a error)..

@GrahamCampbell
Copy link
Member

To confirm if the symfony code is being run can you add a var_dump or something before their code would have raised the deprecation warning?

@GrahamCampbell
Copy link
Member

Does #2626 fix your issue?

@big-shadow
Copy link

Having this issue as well guys.

PHP 7.3
Guzzle 6.5.3

intl PHP extension's loaded.

Here's a stack trace because no one's posted one yet. This isn't a hard fix. I'll submit a pull if it wasn't 4am in Canada.

[2020-04-25 06:51:18] production.ERROR: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated {"exception":"[object] (ErrorException(code: 0): idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated at /home1/shadoxa8/public_html/production-gun-trader/source/vendor/guzzlehttp/guzzle/src/Utils.php:35)
[stacktrace]
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8192, 'idn_to_ascii():...', '/home1/shadoxa8...', 35, Array)
#1 /home1/shadoxa8/public_html/production-gun-trader/source/vendor/guzzlehttp/guzzle/src/Utils.php(35): idn_to_ascii('maps.googleapis...', 0)
#2 /home1/shadoxa8/public_html/production-gun-trader/source/vendor/guzzlehttp/guzzle/src/Client.php(220): GuzzleHttp\\Utils::idnUriConvert(Object(GuzzleHttp\\Psr7\\Uri), 0)
#3 /home1/shadoxa8/public_html/production-gun-trader/source/vendor/guzzlehttp/guzzle/src/Client.php(155): GuzzleHttp\\Client->buildUri(Object(GuzzleHttp\\Psr7\\Uri), Array)
#4 /home1/shadoxa8/public_html/production-gun-trader/source/vendor/guzzlehttp/guzzle/src/Client.php(183): GuzzleHttp\\Client->requestAsync('get', '/maps/api/geoco...', Array)
#5 /home1/shadoxa8/public_html/production-gun-trader/source/vendor/guzzlehttp/guzzle/src/Client.php(96): GuzzleHttp\\Client->request('get', '/maps/api/geoco...', Array)
#6 /home1/shadoxa8/public_html/production-gun-trader/source/app/Http/Controllers/PostController.php(408): GuzzleHttp\\Client->__call('get', Array)

@GrahamCampbell
Copy link
Member

I'll submit a pull if it wasn't 4am in Canada.

I have already prepared a PR, as I said. Please try it out and tell me if it fixes your issue.

@spaantje
Copy link

Does #2626 fix your issue?

I'm not that good with composer; how can i try this out ? (What do i need to require / put in my composer.json?)

@big-shadow
Copy link

big-shadow commented Apr 25, 2020

Ah, jeeze. I'm so sorry @GrahamCampbell. Chalk that up to being awake until 4am.

This was a production issue, and I had to put the fire out pretty quickly. I ended up downgrading:

PHP 7.3 > 7.2
Guzzle 6.5.3 > 6.5.2

All at once, to fix the bug in the prod environment. I'm back online later. Can we link your PR to this issue? I'd love to get us back on the latest version(s) soon.

@GrahamCampbell
Copy link
Member

The PR is linked to the issue?

@spaantje
Copy link

Sorry for the delay; @GrahamCampbell I can confirm that this fixes the issue on my end.
(had to setup a project to test this without destroying the production env)

@spaantje
Copy link

spaantje commented Apr 30, 2020

Any idea when it will be merged in ? 😄 (No rush, but just asking)

@GrahamCampbell
Copy link
Member

Not sure. It needs a review from the Guzzle core, and as much community feedback as possible.

@GrahamCampbell
Copy link
Member

We need to make absolutely sure that the next Guzzle 6.x release works properly, and doesn't break anything else.

@Dahdoul
Copy link

Dahdoul commented Apr 30, 2020

Ah, jeeze. I'm so sorry @GrahamCampbell. Chalk that up to being awake until 4am.

This was a production issue, and I had to put the fire out pretty quickly. I ended up downgrading:

PHP 7.3 > 7.2
Guzzle 6.5.3 > 6.5.2

All at once, to fix the bug in the prod environment. I'm back online later. Can we link your PR to this issue? I'd love to get us back on the latest version(s) soon.

had to do the same, fixed the issue for now

@GrahamCampbell
Copy link
Member

@Dahdoul Please try with the patch. It is not useful to know that downgrading fixed it for you, because we have already established that there is a bug. What is only useful know is to know if the proposed fix actually fixes it for you.

@Dahdoul
Copy link

Dahdoul commented Apr 30, 2020

@Dahdoul Please try with the patch. It is not useful to know that downgrading fixed it for you, because we have already established that there is a bug. What is only useful know is to know if the proposed fix actually fixes it for you.

already applied the patch and it fixes the issue (PHP 7.3.17). I had to downgrade before just to fix the bug in production env.

@Drake24
Copy link

Drake24 commented May 4, 2020

local.ERROR: idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated {"exception":"[object] (ErrorException(code: 0): idn_to_ascii(): INTL_IDNA_VARIANT_2003 is deprecated at /home4/drake24/public_html/alpha.sushicode.com/vendor/guzzlehttp/guzzle/src/Utils.php:35)
[stacktrace]
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8192, 'idn_to_ascii():...', '/home4/drake24/...', 35, Array)

got the same error
"```
require": {
"php": "^7.2",
"clarification/sparkpost-laravel-driver": "^1.2",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.5.2",
"jgrossi/corcel": "^3.1",
"laravel/framework": "^6.2",
"laravel/tinker": "^2.0",
"vemcogroup/laravel-sparkpost-driver": "^3.0"

@Drake24
Copy link

Drake24 commented May 4, 2020

@GrahamCampbell sorry. I just applied manually the #2626 patch you made. and it worked

@amitshahc
Copy link

I faced the same issue: on local windows pc php 7.2.30, guzzle 6.5.3 working fine. but same versions on the server throws this above error with exact line numbers. downgrading guzzle 6.5.2 solved the issue onto the server.
what I suspect is intl behaviour on both the side might be different.

intl on local machine:

version | 1.1.0
-- | --
ICU version | 64.2
ICU Data version | 64.2
ICU TZData version | 2019a
ICU Unicode version | 12.1

intl on server:

version | 1.1.0
-- | --
ICU version | 4.2.1

@fredochieng
Copy link

That constant should be defined, however: https://github.com/symfony/polyfill-intl-idn/blob/master/bootstrap.php#L37.

Hello, I've been trying to fix this error too. What should I do this file?

@GrahamCampbell
Copy link
Member

Don't edit any of those files. Does #2626 fix your issue?

@fredochieng
Copy link

@GrahamCampbell I'm kinda stuck applying #2626. Should I edit Utils.php file?

@fredochieng
Copy link

fredochieng commented May 5, 2020 via email

@runphp
Copy link

runphp commented May 12, 2020

Guzzle version(s) affected: 6.5.3
PHP version:7.3.13
cURL version:7.19.7
ICU version => 4.2.1
ICU TZData version => 2009j
ICU Unicode version => 5.1

update "symfony/polyfill-intl-idn":"v1.16.0"

An error IDN conversion failed occurred

@runphp
Copy link

runphp commented May 12, 2020

This pull #2626 resolve error

@Nyholm
Copy link
Member

Nyholm commented May 23, 2020

#2626 is merged.

@Nyholm Nyholm closed this as completed May 23, 2020
@flowser
Copy link

flowser commented May 25, 2020

i stll get ame error

@GrahamCampbell
Copy link
Member

@flowser Are you installing the latest dev version? The code has not actually been tagged yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests