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
Call to undefined function GuzzleHttp_idn_uri_convert() #2511
Comments
Please check this answer here: #2502 (comment) execute a similar code to your system and let me know if the error persists.. |
Hi @gmponos thanks for the quick reply. I don't have any sub applications that are calling guzzle, which is referenced in the #2502 Was there another action that I should take from that resolution? Here is the log from our GitLab CI/CD build - showing only one guzzlehttp/guzzle installation: Thanks again Jim |
Sorry maybe I was not clear. I wanted you to create a small reproducer like the one on my comment. composer.json:
I have also added a Execute the reproducer at your serer and let me know of the result... Also the info you provide at your first comment are a littke bit scrambled and they do not help... |
Based on this line, this is a WordPress plugin:
Chances are you have other plugins autoloading an earlier version of Guzzle (similar to the subapplication case). Please check if any other plugins install wordpress and if so, they install the latest version. |
I'm also getting this issue. I use the https://github.com/googleapis/google-api-php-client project to verify in-app purchases on my backend. My composer set up is as follows:
It would seem that the google-api-php-client uses guzzle and thus when I execute one of the API calls, it uses the wrong version of guzzle. Any suggestions on what I can do? Any help appreciated. |
@MattheusRossopIII in order to find the bug I will need a reproducer.. similar as my example above.. with more details about the platform (curl and php version.. is intl installed?) The function exists in 6.5.2 https://github.com/guzzle/guzzle/blob/6.5.2/src/functions.php#L358 and this issue (#2502) and the fact that it is resolved confirms that the function is there... :/ |
@gmponos Some more details: Code that now fails: PHP info: Curl info: |
|
The /var/www/html/vendor/guzzlehttp/guzzle/composer.json is as follows (not sure if helpful):
/var/app/current/vendor/guzzlehttp/guzzle/src/functions.php includes this in the script:
The Client.php line 220 needs to be changed to use the functions.php _idn_uri_convert method I suggest? I can't do this obviously as each time AWS EB creates new EC2 instances and the problem will persist! |
@gmponos This happens to me on a laravel test case. If i run your code on a simple php file it works fine. However this happens on a fresh laravel project. ExampleTest.php
Result from
composer.json
|
Can you paste your composer.lock file too please? |
@GrahamCampbell of course. Edit: there was a composer.lock content pasted here, but I came to a solution on #2511 (comment) |
@GrahamCampbell @gmponos Ok guys, I looked into my global composer packages, and I had Guzzle on version 6.3.3, I updated global packages which also upgraded PHPUnit and the test passes now. Do you have any idea why a global package can interfere with a project's dependency, shouldn't it execute the local project dependency files? Thanks. |
Was the global dependency the laravel installer? |
I believe that the fact that 2 out of 4 related problems reported is hinting that the issue most probably is not in guzzle.. Never the less there is the benefit of doubt. Out of the info that we have for the reported issue we can not provide currently a solution since AFAIK the code is working. PS. @mrluissan can you just replace with |
@GrahamCampbell Yes, I do have the laravel installer as a global dependency, and guzzle too. I don't know if installing the laravel installer globally it also installs Guzzle separately. I'm gonna paste my current
@gmponos I don't understand what you are actually telling me to try, sorry. I don't have a solid knowledge of how Composer works. If you can elaborate it more I'll try gladly. |
I meant on the comment above replace the contents with composer show or delete the comment. it is not needed all the lock file since you've found the solution. |
I wonder if the laravel installer should try a phar distribution strategy without dependencies, like phpstan 0.12 does, to mitigate these types of problems. // cc @taylorotwell @driesvints |
That is, you install the package through composer still, but what that actually does is download the phar using composer. |
The problem is the always autoloaded functions. There is a condition in the beginning of the file to check if one of the functions already exist. If it does, it won't load them again. This was a "fix" for global package usage in the first place. I'm guessing the global package is loaded first. Not sure what would be the correct fix here. We could move the functions to a util class as static functions, that would eliminate the need to always load the functions file. I guess the autoloader will check package dependencies first. Although I find it odd that a different version of the same package is autoloaded in the first place. |
Can anybody suggest a solution for developers like myself who are experiencing the issue using the google-api-php-client using AWS? Everything was working fine until a few weeks ago and now the Guzzle dependency is failing. So our set up is using composer to load the latest google-api-php-client library. This library in turn uses Guzzle, but it's failing (as documented above). Any suggestions will be appreciated and I can test them to see if they will work for us. |
I'm also a user of google/apiclient but haven't had a bad experience yet. Note that google/apiclient has this guzzle dependency: So it works with either 5 or 6. However in my project I a) don't have global dependency and b) I've an explicit root dependency (for other parts) on guzzlehttp/guzzle 6. |
We are experiencing this with What information can I provide to help debug this? |
Same here! Downgraded from |
@MattheusRossopIII @ChrisThompsonTLDR @egyptik can you please check/confirm that you don't have Guzzle installed globally? It might get installed with a tool that you install globally in your workspace eg. |
@sagikazarmark Just checked - I don't. But I am also using |
In this case, can you give me a |
I do not have Guzzle installed globally. My application doesn't have a |
I meant a simple PHP script that executing from the CLI reproduces the issue. |
@GrahamCampbell Beg your pardon.. but, given I use google/cloud-firestore, which isn’t directly requiring guzzle (does it through sub-packages like google-auth and cloud-core), how do I force your patch into it? Do I simply append it in the composer file? I’m on mobile now, that’s why I asked rather than try it out. Meanwhile, I’ve worked around it by adding the exists check to each function, given it wont upgrade unless I want it to. Regards! |
@edi, you would put this in your application's
|
I had a similar case on a laravel 5.8 where I was executing some queue jobs via a supervisor service. Looks like the service worker was loading some old autoload file, so only |
Sorry, but when will this fix be pushed? It's been months and most of our libraries are failing with this error because they're trying to use |
@bshaffer You can always use older versions until it's fixed... I it's not what you want, but, it's something... 😄 |
@giovannipds This is a good idea, although we will want to continue with semantic versioning once the bug gets fixed. We can try excluding the errant version in our core library like this: {
"require": {
"guzzlehttp/guzzle": "~5.3.1|~6.0, !=6.5.2"
}
} I am curious if there is justification for why the fix has taken so long (pinging @gmponos) |
Thank you @GrahamCampbell. I've merged your two fixes. I will start to prepare a release for 6.5.3 |
Please install {
"require": {
"guzzlehttp/guzzle": "6.5.x-dev"
}
} |
@Nyholm It works for me, no more errors. I'm using quite a lot of stuff applied to the client (Middleware) and nothing fails. |
Upgraded to 6.5.3 via |
@jagermesh Could you open a new issue where you show a stack trace? |
sorry, it was in sub-project which has own composer.json, seems fine after both were upgraded |
For me, this issue occurred when requiring a second project's autoloader that had a different version of guzzle
|
Yes @bkdotcom, you are very correct. If you have more than one installation of guzzle, and they are of different versions. Then yes, you will have issues with your autoloader. I mean.. you are loading two classes with the exact same FQCN. Im locking this issue since all the answers is already written. If someone still have issues, feel free to open a new issue. |
Hello - after the December 2019 updates, we are receiving the following error. Our client code calls into Guzzle at #2, so we don't call GuzzleHttp_idn_uri_convert() directly:
[28-Dec-2019 17:57:20 UTC] PHP Fatal error: Uncaught Error: Call to undefined function GuzzleHttp_idn_uri_convert() in wp-content/plugins/q4vrplugin/vendor/guzzlehttp/guzzle/src/Client.php:220
Stack trace:
#0 guzzlehttp/guzzle/src/Client.php(155): GuzzleHttp\Client->buildUri(Object(GuzzleHttp\Psr7\Uri), Array)
#1 guzzlehttp/guzzle/src/Client.php(183): GuzzleHttp\Client->requestAsync('GET', 'units', Array)
#2 plugin/Models/ApiClient.php(97): GuzzleHttp\Client->request('GET', 'units', Array)
Please let me know what additional information I can provide to assist.
Thanks!
Jim
The text was updated successfully, but these errors were encountered: