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

Avoid using func_get_args #1741

Closed
wants to merge 1 commit into from
Closed

Avoid using func_get_args #1741

wants to merge 1 commit into from

Conversation

ramya-stripe
Copy link
Contributor

Resolves the incompatibility issues with PHP 8.0 as described in #1739

@@ -199,7 +199,7 @@ private function constructRequest($method, $absUrl, $headers, $params, $hasFile)

$opts = [];
if (\is_callable($this->defaultOptions)) { // call defaultOptions callback, set options to return value
$opts = \call_user_func_array($this->defaultOptions, \func_get_args());
$opts = \call_user_func_array($this->defaultOptions, [$method, $absUrl, $headers, $params, $hasFile]);
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a really obscure case where this is breaking. For users on PHP < 7, \call_user_func_array returns the original value of $method (i.e. before we do $method = \strtolower($method) on line 198), but this change will change it to lower case it. Since $this->defaultOptions is a potentially-user-defined callback we can't be 100% certain this won't break somebody, but this would only happen in an instance where somebody was introducing a non-lower-cased verb into our request infrastructure (custom requests?)

I think this case is unlikely but maybe it would be better to postpone this to the major?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

custom requests are only available on the beta SDKs, not the GA ones - so we should be good?

Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately you can initialize StripeClient or ApiRequestor directly and call ->request (happens in the wild). I don't think we ever documented this though, so it's probably fine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fair enough, will close this out and this can go in the next month's major release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants