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
Exception: Host must be a string #2458
Comments
Definitely rubber ducking here. 🦆 Looks like the IDN support was just added in 6.5.0 which is why I'm only running into it now. The problem appears introduced in #2286 - in combination with the wildly out of date intl/ICU situation. I've managed to prevent the problem by adding While I'll prompt the server admin about intl/ICU, I think it's probably a good idea to correct the check for The call to Changing
to
causes the regular error handling to kick in which makes it throw an I'd argue that it should not throw an exception for a failed IDN conversion at all, or perhaps only when a special option is set so the user makes idn conversion mandatory). I'd be happy to try and prepare a patch, but would appreciate some guidance on what others think the best way to fix this would be. |
Please take a look at #2454 |
Ahh.. excellent! :) Confirmed that fixes the issue on my environment. |
@Mark-H changing |
Guzzle version(s) affected: 6.5.0
Description
While attempting to communicate with the Mailchimp API, I'm presented with:
Exception Host must be a string
Trace:
While the proper url is being passed by the calling code (shown below) into Client->request, which calls Client->requestAsync with still the right URL, that is somehow turned into an
Uri
object which somehow trips things up and causes the withHost to useNULL
.Did notice some PHP warnings that may be relevant:
How to reproduce
Honestly, "it works on my machine" (meaning my local development environment), but it breaks on a hosted staging environment and I don't have the faintest idea why. I've been baffled for 2 days at this error.
Here's the relevant code that calls the Guzzle client, pretty standard stuff:
Originally the url was dynamic, but I hardcoded it to eliminate any errors there. Initially without the timeout, found an older issue suggesting to add the timeout, didn't change the behaviour.
Possible Solution
Wish I knew!
Additional context
guzzlehttp/guzzle 6.5.0, guzzlehttp/promises 1.3.1, guzzlehttp/psr7 1.6.1
This environment also has guzzle/guzzle 3.9.3 (as a dependency of another dependency), but that hasn't gotten in the way of anything before. Can't use guzzle 7 yet as the software supports PHP 7.1 until March.
PHP 7.3.11, on a shared server.
As the PHP warnings mention intl, I checked, and that is installed with ICU version 4.2.1.
Doing a bit more research into the php warnings:
.. this might just be the problem in idn_to_ascii:
ICU 4.2.1 is installed on this server. That probably causes idn_to_ascii to return false rather than a hostname it can use..
The text was updated successfully, but these errors were encountered: