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

IDN conversion failed (errors: IDNA_ERROR_EMPTY_LABEL) #2600

Closed
ClaryPollack opened this issue Mar 15, 2020 · 17 comments
Closed

IDN conversion failed (errors: IDNA_ERROR_EMPTY_LABEL) #2600

ClaryPollack opened this issue Mar 15, 2020 · 17 comments

Comments

@ClaryPollack
Copy link

Guzzle version(s) affected:"guzzlehttp/guzzle": "^6.3",
PHP version: x.y.z (hint: php --version): 7.4.2
cURL version: x.y.z (hint: php -i | grep cURL): 7.68.0

Description

Error message when installing Scout (Searchable) and Algolia. The error message is "IDN conversion failed (errors: IDNA_ERROR_EMPTY_LABEL) at vendor/guzzlehttp/guzzle/src/functions.php:384." Saw on Stack Overflow that it works to revert to Guzzle 6.2, but know you prefer we use the most recently updated/stable version.

Additional context
Using Laravel 7.1.3.

@Maximus1000
Copy link

Same. Laravel 7.1.3, Guzzle 6.5.2. PHP 7.4.2. Error occurs when I attempt to save a related model from an observer method per a factory call.

I can create a user using a standard factory call in Tinker (no error). And, I can record log info from the UserObserver creating or created methods fired from that factory call. But, if I try to save or change related models from an observer or a boot method, I get the IDNA translation error.

@dniccum
Copy link

dniccum commented Mar 24, 2020

I am receiving the same error with Guzzle 6.5.2, Laravel 6.17.1, PHP 7.3.8, while trying to run some unit tests:

$response = $this->postJson('/ajax/jurisdiction-media', [
   'name' => $name,
   'url' => $url,
   'user_id' => $user->id,
   'jurisdiction_id' => $jurisdiction->id
]);

@samgyamfi
Copy link

Guzzle version(s) affected:"guzzlehttp/guzzle": "^6.3",
PHP version: x.y.z (hint: php --version): 7.4.2
cURL version: x.y.z (hint: php -i | grep cURL): 7.68.0

Description

Error message when installing Scout (Searchable) and Algolia. The error message is "IDN conversion failed (errors: IDNA_ERROR_EMPTY_LABEL) at vendor/guzzlehttp/guzzle/src/functions.php:384." Saw on Stack Overflow that it works to revert to Guzzle 6.2, but know you prefer we use the most recently updated/stable version.

Additional context
Using Laravel 7.1.3.

I am currently facing a similar problem. I'm using guzzle version 6.5. Here is the error message:
GuzzleHttp\Exception\InvalidArgumentException
IDN conversion failed
\vendor\guzzlehttp\guzzle\src\functions.php:384

Any solution to help me?

@Nemo64
Copy link

Nemo64 commented Apr 1, 2020

My current workaround is to define a conflict with "guzzlehttp/guzzle": "6.5.*".
The function \GuzzleHttp\_idn_uri_convert seems to be new in 6.5.

I'd love to investigate more but i don't have time right now.
It seems that defined('INTL_IDNA_VARIANT_UTS46') is false so i have the "old php variant".
I run php 7.2.10 with intl 1.1.0 with icu data version 4.4.0.1.
ICU data made problems on mittwald in the past so i include that (because the docs say idn is part of intl)

I did a few tests but all worked correctly as expected:

echo '<?php var_dump(idn_to_ascii("example.com", 0));' > test.php
echo '<?php var_dump(idn_to_ascii("example.com", true));' > test.php
echo '<?php var_dump(idn_to_ascii("example.com", IDNA_DEFAULT));' > test.php

@Nemo64
Copy link

Nemo64 commented Apr 1, 2020

I think i found the issue.
$idnaVariant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : 0;
In my tests this results in 0 but in the production code it is 1.

The problem seems to be https://github.com/symfony/polyfill-intl-idn which defines that constant https://github.com/symfony/polyfill-intl-idn/blob/master/bootstrap.php#L37 if IDNA_DEFAULT is not present.

@micron
Copy link

micron commented Apr 1, 2020

I am facing this issue to. I found #2448 which looks similar. I updated to guzzle 6.5.2 but I am still facing this issue. (Problem occurs only on Mittwald servers)

PHP-FPM: 7.2.10
intl: 1.1.0
ICU version: 4.4.1
ICU Data version: 4.4.0.1
ICU TZData version: 2010i
ICU Unicode version: 5.2

@t3easy
Copy link

t3easy commented Apr 3, 2020

Same problem with TYPO3 9.5.15 and guzzle 6.5.2 also on a Mittwald hosting!

Uncaught TYPO3 Exception: IDN conversion failed | GuzzleHttp\Exception\InvalidArgumentException

@Wei102193
Copy link

In my case, It was because of "Laravel\Scout\Searchable". If you haven't set up Scout properly or you don't need them, remove trait Searchable from your model might fix this problem.

@dniccum
Copy link

dniccum commented Apr 28, 2020

@Wei102193 That did it for me. I made the following change to me .env file within my CI integration and it worked:

SCOUT_DRIVER=null

@dhafer95
Copy link

that actually worked for me thanks

@Wei102193 That did it for me. I made the following change to me .env file within my CI integration and it worked:

SCOUT_DRIVER=null

@GrahamCampbell
Copy link
Member

I think this could be fixed by #2626.

@samhannan
Copy link

I encountered the same issue.

It turns out I had some hidden ancii characters in my API host string in my .env file. Simply retyping the string instead of copy-pasting solved the issue for me.

@fredochieng
Copy link

_idn_uri_convert

Can you explain to me how it worked? I have the same error

@anuranin
Copy link

Facing the same problem
I am using PHP 7.1.14

SDK :

Using version ^3.137 for aws/aws-sdk-php
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 10 installs, 0 updates, 0 removals

  • Installing symfony/polyfill-mbstring (v1.16.0): Loading from cache
  • Installing mtdowling/jmespath.php (2.5.0): Loading from cache
  • Installing guzzlehttp/promises (v1.3.1): Loading from cache
  • Installing ralouphie/getallheaders (3.0.3): Loading from cache
  • Installing psr/http-message (1.0.1): Loading from cache
  • Installing guzzlehttp/psr7 (1.6.1): Loading from cache
  • Installing symfony/polyfill-php72 (v1.16.0): Loading from cache
  • Installing symfony/polyfill-intl-idn (v1.16.0): Loading from cache
  • Installing guzzlehttp/guzzle (6.5.3): Loading from cache
  • Installing aws/aws-sdk-php (3.137.6): Loading from cache
    guzzlehttp/psr7 suggests installing zendframework/zend-httphandlerrunner (Emit PSR-7 responses)
    guzzlehttp/guzzle suggests installing psr/log (Required for using the Log middleware)
    aws/aws-sdk-php suggests installing doctrine/cache (To use the DoctrineCacheAdapter)
    aws/aws-sdk-php suggests installing aws/aws-php-sns-message-validator (To validate incoming SNS notifications)

$s3Client = new S3Client([
'version' => 'latest',
'region' => 'my-region',
'credentials' => [
'key' => 'xxx',
'secret' => 'yyy'
]
]);
$file_Path = DIR.'/php-code.txt';
$key = basename($file_Path);
$result = $s3Client->putObject([
'Bucket' => '',
'Key' => $key,
'Body' => fopen($file_Path, 'r'),
]);
$result = $s3Client->getObject([
'Bucket' => 'my-bucket',
'Key' => 'my-key'
]);
echo $result['Body'];

What could be the issue?

@jonnott
Copy link
Contributor

jonnott commented May 12, 2020

FWIW, today the update to symfony/polyfill-intl-idn v1.16 (from 1.15) just completely broke all my Guzzle usages. This is on a server running CentOS 6 (and therefore old ICU - 4.2.1?) and PHP 7.3

@Nyholm
Copy link
Member

Nyholm commented May 23, 2020

Try to the latest changes in the 6.5 branch. Will that fix this issue?

@ClaryPollack
Copy link
Author

Sorry for the delay. This worked for me as it appears the issue was due to incompatibilities between versions (Laravel Scout/Algolia/Guzzle) and not Guzzle itself:

1.	composer remove algolia/scout-extended
2.	composer remove algolia/algoliasearch-client-php:^2.2
3.	composer remove laravel/scout
4.	composer clearcache
5.	composer update
6.	composer require algolia/scout-extended 
⁃	*This time, it used version ^1.9 for algolia/scout-extended
7.	php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"
8.	composer require guzzlehttp/guzzle:6.4.1
⁃	*Add your Algolia info to the .env file then run:
9.	php artisan scout:import "App\Post"

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