thephpleague / omnipay-common

Core components for the Omnipay PHP payment processing library
MIT License
329 stars 242 forks source link

Issue with Guzzle 6.5.3 #218

Open yellow1912 opened 4 years ago

yellow1912 commented 4 years ago

Hello,

On the latest stable version of Guzzle, the PSR compatible methods are:

send
sendAsync

https://github.com/guzzle/guzzle/blob/aab4ebd862aa7d04f01a4b51849d657db56d882e/src/Client.php#L107

However, on Omni's Client, we are calling sendRequest method:

https://github.com/thephpleague/omnipay-common/blob/24ea70aa6e0f76d8b85d7a35d8a6560c746f566f/src/Common/Http/Client.php#L67

This will cause the Guzzle client to call the magic __call method which in turn will call the request method instead:

https://github.com/guzzle/guzzle/blob/aab4ebd862aa7d04f01a4b51849d657db56d882e/src/Client.php#L85

https://github.com/guzzle/guzzle/blob/aab4ebd862aa7d04f01a4b51849d657db56d882e/src/Client.php#L180

I'm not sure how this should be handled, perhaps we check for guzzle's version? Or check for Guzzle's class and the presence of the method sendRequest?

barryvdh commented 4 years ago

PSR-18 (https://www.php-fig.org/psr/psr-18/) defines the sendRequest method, which is used by us. It seems that only Guzzle 7 will support PSR-18 directly, for Guzzle 6 the adapter is used: http://docs.php-http.org/en/latest/clients/guzzle6-adapter.html