braintree / braintree_php

Braintree PHP library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
547 stars 224 forks source link

PHP 8.2 Compatibility #325

Closed markdavidsonEE closed 1 year ago

markdavidsonEE commented 1 year ago

Summary

These changes intend to fix a number of deprecation warnings encountered when using the library under PHP 8.2 e.g. Creation of dynamic property Braintree\\Result\\Successful::$transaction is deprecated

Where possible the properties have simply been added to the classes. However in the case of Instance this was not possible and it does require the use of dynamic properties currently. So a workaround of extending stdClass has been used see https://php.watch/versions/8.2/dynamic-properties-deprecated#stdClass for more details.

Additionally this resolves https://github.com/braintree/braintree_php/issues/324 credit to @mvoelker for initial hint on partial solution.

Checklist

laoneo commented 1 year ago

Thanks @markdavidsonEE .Would love to see this one merged for better PHP 8.2 compatibility.

slepic commented 1 year ago

@markdavidsonEE thank you very much for this PR. Can you please merge updates from braintree:master. I might use your fork then... Dont wanna wait for Godot...

crookedneighbor commented 1 year ago

Solid Samuel Becket reference @slepic

We'll be prioritizing this soon. We're a very small team and have a lot of responsibilities, but this is near the top of my list of things we need to address now that we've finished up some other high priority things.

Thank you so much for kickstarting this with the PR @markdavidsonEE and sorry it has taken us so long to respond.

markdavidsonEE commented 1 year ago

Great stuff @crookedneighbor happy to help out.

@slepic that's now up to date with master.

crookedneighbor commented 1 year ago

This is out in v6.11.1

I didn't realize it was quite common for PHP projects to treat deprecation warnings as full-blown errors. If I had known that ahead of time, I would have prioritized getting this out sooner. Sorry for the wait!

benedict-tshaba commented 1 year ago

Ran into this issue when updating to PHP 8.2 in prod yesterday. Glad its fixed. Has a release been cut with these changes and if so, which version? We are currently on 6.10.0.

crookedneighbor commented 1 year ago

Yes, we released it earlier this week in v6.11.1