Aws-sdk-php: guzzle version wrong? undefined function

Created on 10 May 2020  路  6Comments  路  Source: aws/aws-sdk-php

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
Just doesn't seem to work. I'm trying to query my current file list on a Digital Ocean Space. Looks like it's trying to get a function that doesn't exist.

Warning: Use of undefined constant IDNA_DEFAULT - assumed 'IDNA_DEFAULT' (this will throw an Error in a future version of PHP) in /media/storage/website/public_html/includes/aws/GuzzleHttp/Client.php on line 219

Fatal error: Uncaught Error: Call to undefined function GuzzleHttpidn_to_ascii() in /media/storage/website/public_html/includes/aws/GuzzleHttp/Utils.php:35 Stack trace: #0 /media/storage/website/public_html/includes/aws/GuzzleHttp/Client.php(220): GuzzleHttp\Utils::idnUriConvert(Object(GuzzleHttp\Psr7\Uri), 'IDNA_DEFAULT') #1 /media/storage/website/public_html/includes/aws/GuzzleHttp/Client.php(113): GuzzleHttp\Client->buildUri(Object(GuzzleHttp\Psr7\Uri), Array) #2 /media/storage/website/public_html/includes/aws/Aws/Handler/GuzzleV6/GuzzleHandler.php(43): GuzzleHttp\Client->sendAsync(Object(GuzzleHttp\Psr7\Request), Array) #3 /media/storage/website/public_html/includes/aws/Aws/WrappedHttpHandler.php(87): Aws\Handler\GuzzleV6\GuzzleHandler->__invoke(Object(GuzzleHttp\Psr7\Request), Array) #4 /media/storage/website/public_html/includes/aws/Aws/ClientSideMonitoring/AbstractMonitoringMiddleware.php(126): Aws\WrappedHttpHandler->__invoke(Object(Aws\Command), Object(GuzzleHttp\Psr7\Request)) #5 /media/storage/website/public_h in /media/storage/website/public_html/includes/aws/GuzzleHttp/Utils.php on line 35

Version of AWS SDK for PHP?
Example: 3.137.6

Version of PHP (php -v)?
7.4.5

To Reproduce (observed behavior)
Download the aws php package, include as normal using _aws-autoloader_ and try to do anything.

Looking around, other projects had the same issue. It appears to happen in later versions of Guzzle. MediaWiki had the issue too, so they seemed to force a specific older Guzzle version.

Testing myself, by overwriting with Guzzle 6.3.3 it now works. So something needs to be done here.

bug

All 6 comments

Hey. Guzzle maintainer here.

The problem is that you have two different guzzle versions installed and loaded.

This error is fixed if you update one of them to 6.5.3.

Nothing else in my project uses Guzzle.

That is not what I said.

I said that you have two version of Guzzle loaded in your PHP runtime at the same time. That is why you are getting the error.


Also, did you try my solution?

That is not what I said.

Apologies, it wasn't overly clear you meant loaded into PHP and not the project I am on.

Also, did you try my solution?

Yes, doesn't work. 6.3.3 does.

I can confirm the same issue under PHP 7.3 when using AWS SDK (accessing an S3 bucket). Downgrading guzzlehttp to 6.3.3 worked for me.

Thanks for reaching out to us about this @LiamDawe and @bluusun (and thanks for chiming in on this @Nyholm!). While I'm unable to reproduce this when downloading the AWS SDK for PHP via composer, I do see this behavior if I import version 3.137.6 of the SDK via the .phar and .zip releases.

Looking further into this it seems like our .zip and .phar packages aren't including the package symfony/polyfill-intl-idn required by Guzzle 6.5.3 which is where the constant IDNA_DEFAULT is being defined for this version of Guzzle. I'll submit a PR that includes this package in our build shortly.

In the meantime, IDNA_DEFAULT is a constant defined in the Intl extension, enabling this extension in PHP should resolve this behavior.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Intrepidity picture Intrepidity  路  4Comments

doapp-ryanp picture doapp-ryanp  路  5Comments

LCamel picture LCamel  路  4Comments

muratsplat picture muratsplat  路  4Comments

GeekLad picture GeekLad  路  5Comments