-
Notifications
You must be signed in to change notification settings - Fork 176
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
Constructor of Shopify\Auth\Scopes can't handle null #290
Comments
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days. |
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days. |
We are closing this issue because it has been inactive for a few months. If you still encounter this issue with the latest stable version, please reopen using the issue template. You can also contribute directly by submitting a pull request– see the CONTRIBUTING.md file for guidelines Thank you! |
No one fixed this issue yet ?? |
Issue summary
During Auth Begin, a session is created without any scope / accessToken etc.. set. So these fields are null. In this state if $session->isValid() is called, it results in a TypeError.
Because isValid calls
Context::$SCOPES->equals($this->scope)
.Here
$this->scope
is null.SCOPES->equals
calls$scopes = new self($scopes);
.And in the constructor of
Scopes
shopify-api-php/src/Auth/Scopes.php
Lines 19 to 27 in d368eef
is_string
returns false for null type, but this code assumes that is not string, then must be array and continues. Resulting inarray_map
call throwing a TypeError because it expects array, but null given.Expected behavior
What do you think should happen?
No PHP TypeError should happen.
Actual behavior
What actually happens?
TypeError
Steps to reproduce the problem
php -a
Reduced test case
The best way to get your bug fixed is to provide a reduced test case.
Checklist
Possible Solution
Adding
?? []
should fix it.Or
Session->isValid
shouldn't callContext::$SCOPES->equals
if$this->scope
is null.The text was updated successfully, but these errors were encountered: