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

Call toArray() on objects only #749

Merged
merged 1 commit into from
Sep 26, 2019
Merged

Call toArray() on objects only #749

merged 1 commit into from
Sep 26, 2019

Conversation

alies-dev
Copy link
Contributor

method_exists($value, 'toArray') has 2 arguments, the first one is an object instance or a class name, see https://www.php.net/manual/en/function.method-exists.php

It's possible that developers can store full qualified classname to SrtripeObject meta and thus this line

return method_exists($value, 'toArray') ? $value->toArray() : $value;
will throw a fatal error Call to a member function toArray() on string: https://3v4l.org/2Gh07

Copy link
Contributor

@ob-stripe ob-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch!

@ob-stripe ob-stripe merged commit e57cd77 into stripe:master Sep 26, 2019
@alies-dev alies-dev deleted the fixed-toArray branch September 26, 2019 19:38
@alies-dev alies-dev restored the fixed-toArray branch September 26, 2019 19:39
@alies-dev alies-dev deleted the fixed-toArray branch October 3, 2019 12:46
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 this pull request may close these issues.

3 participants