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

Allow expires_in equals 0 #606

Merged
merged 2 commits into from
Jan 25, 2017
Merged

Allow expires_in equals 0 #606

merged 2 commits into from
Jan 25, 2017

Conversation

artad
Copy link

@artad artad commented Jan 19, 2017

Some services (http://vk.com, no expiration) return "expires_in" equals 0 and no "expires".
In this case:
!empty($options['expires_in']) == FALSE
!empty($options['expires']) == FALSE
and expires property remain NULL

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling a17b6fc on artad:master into 4aec352 on thephpleague:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling a17b6fc on artad:master into 4aec352 on thephpleague:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling a17b6fc on artad:master into 4aec352 on thephpleague:master.

@ramsey
Copy link
Contributor

ramsey commented Jan 24, 2017

Thanks, @artad.

This seems to comply with the definition of "expires_in" in appendix A.14. of RFC 6749:

expires-in = 1*DIGIT

It can be 1 or more DIGIT, where RFC 5234 defines DIGIT as

     DIGIT          =  %x30-39
                            ; 0-9

Any concerns, @shadowhand?

@ramsey ramsey requested a review from shadowhand January 24, 2017 23:04
@shadowhand
Copy link
Member

LGTM.

@ramsey
Copy link
Contributor

ramsey commented Jan 25, 2017

Thanks!

@ramsey ramsey merged commit 3a07112 into thephpleague:master Jan 25, 2017
@artad
Copy link
Author

artad commented Jan 25, 2017

Thanks for your attention

@ghost
Copy link

ghost commented Aug 16, 2017

This breaks the code tho, hasExpired() uses the PHP empty() function to determine if expires is set or not. 0 is considered empty using that function.

As is, it yields the following error

RuntimeException: "expires" is not set on the token in vendor/league/oauth2-client/src/Token/AccessToken.php on line 174

SvanteRichter pushed a commit to BoltAuth/Auth that referenced this pull request Feb 21, 2021
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.

4 participants