XeroAPI / xero-php-oauth2

Xero PHP SDK for oAuth 2 generated from Xero API OpenAPI Spec 3.0
MIT License
91 stars 65 forks source link

GuzzleHttp\Psr7\build_query() function error in fresh composer install of xeroapi/xero-php-oauth2 #240

Closed timwiel closed 2 years ago

timwiel commented 3 years ago

SDK you're using (please complete the following information):

Describe the bug Installing fresh composer install of xeroapi/xero-php-oauth2 leads to php error as follows:

Uncaught Error: Call to undefined function GuzzleHttp\Psr7\build_query()

This is because a fresh and default install using composer drags down guzzlehttp/psr7 version 2.0 which has removed the psr7/src/functions.php file as per the comment in the 1.8.2 version of that file @deprecated build_query will be removed in guzzlehttp/psr7:2.0. Use Query::build instead.

It can be fixed by forcing a composer downgrade of the guzzlehttp/psr7 to version 1.8 using the composer command: composer require guzzlehttp/psr7 "^1.8"

Expected behavior Composer install of xeroapi/xero-php-oauth2 should just work without the need to downgrade dependancies manually

xiyue-aikeji commented 3 years ago

Having the same error. Downgrading fixed it. Yeah please fix this. Thanks.

robroypt commented 3 years ago

Yep, fixed it for me as well.

I'm using PHPStorm - I added the following line to my composer.json file and hit "Update"

"require": { ... "guzzlehttp/psr7": "^1.8", ... }

SerKnight commented 3 years ago

I've included this in the 2.7.0 release. I was unable to recreate it initially, but I tested against a fresh install and it worked well for me. Please let me know otherwise, and if this release remedies the need to manually downgrade psr7

andrews05 commented 3 years ago

This seems wrong. Wouldn’t a better fix be to actually do what it says? Use Query::build instead. This is compatible with v1.x too, so it won’t matter what version people actually use.

SerKnight commented 3 years ago

Yeah - Re-opening to evaluate refactoring to use newest release of psr7 Query::build for a future release.

MorganGonzales commented 2 years ago

Hello @SerKnight, just in case; I created a PR for this issue #249 This is my first time contributing (publicly) so please correct me if I had invalidated any rules.

IanSimpson commented 2 years ago

Not sure if this is the right place for it, or if we should make a new issue, but we're using an outdated version of guzzlehttp/psr7. Currently:

"guzzlehttp/psr7": "^1.8",

Something like...

"guzzlehttp/psr7": "^1.8|^2.0",

would be better. Currently this is preventing update of this package (which is used by a number of other packages in my application).

adarshv commented 2 years ago

Please upgrade and refactor with Query::build. Unable to use with other packages.

joshradics commented 2 years ago

It would be great to see some action on this issue. In my case, I cannot downgrade Guzzle without refactoring more than half my application, which means I am unable to use this library.

RettBehrens commented 2 years ago

Hey all. This is going to be included in an upcoming release soon, next week hopefully.

Apologies for the delay on this. There were significant changes for the team last year and we're looking to ramp up velocity this year now that we're back to full headcount.

ricuss commented 2 years ago

Thanks for the update @RettBehrens - looking forward to it as it's also causing some issues in our application

RettBehrens commented 2 years ago

Resolved in the latest release. Made the necessary changes upstream in our code generator repo.