Skip to content
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

Array Functions on Objects Soon to be Deprecated #723

Closed
RealityRipple opened this issue Aug 30, 2019 · 3 comments · Fixed by #552
Closed

Array Functions on Objects Soon to be Deprecated #723

RealityRipple opened this issue Aug 30, 2019 · 3 comments · Fixed by #552
Assignees
Labels

Comments

@RealityRipple
Copy link

Objects currently behave fairly close to Arrays, however PHP 7.4 will be adding a notice of deprecation for many Array-purpose-functions on Objects. It would probably be a good idea to make a few preemptive changes before 7.4 is released.
So far, I've only noticed something that would be a problem on line 402 of lib/ApiRequestor.php, though there may be other instances. array_key_exists will throw a warning because $rheaders is an Object, not an Array.

@ob-stripe
Copy link
Contributor

Thanks for the heads up @RealityRipple! I had no idea array_key_exists() did not handle \ArrayAccess and just fell back to object properties.

I've opened a PR to start testing PHP 7.4, and sure enough those builds are red, e.g. https://travis-ci.org/stripe/stripe-php/jobs/578611239.

We'll fix this before PHP 7.4 is officially released.

@ob-stripe ob-stripe self-assigned this Aug 30, 2019
@ob-stripe
Copy link
Contributor

This is the RFC describing the new behavior: https://wiki.php.net/rfc/deprecations_php_7_4#array_key_exists_with_objects

This was referenced Aug 30, 2019
@ob-stripe
Copy link
Contributor

This is fixed in stripe-php v7.0.0.

@ob-stripe ob-stripe mentioned this issue Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants