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

fix for invalid expires value #929

Closed

Conversation

hendeavors
Copy link
Contributor

Fixes bug for PHP 7.1+:

A non-numeric value encountered

When attempting to add a non-numeric value $expires to getTimeNow an error is thrown. This should be non-breaking and preserve PHP 5 behavior.

@codecov
Copy link

codecov bot commented Dec 17, 2021

Codecov Report

Merging #929 (12a6ad5) into master (a2ae5b0) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 12a6ad5 differs from pull request most recent head 1dcec57. Consider uploading reports for the commit 1dcec57 to get more accurate results

Impacted file tree graph

@@             Coverage Diff             @@
##              master      #929   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
+ Complexity       190       181    -9     
===========================================
  Files             20        20           
  Lines            514       463   -51     
===========================================
- Hits             514       463   -51     
Impacted Files Coverage Δ
src/Token/AccessToken.php 100.00% <100.00%> (ø)

... and 7 files with indirect coverage changes


$token = $this->getAccessToken($options);

$this->assertSame($token->getExpires(), $token->getTimeNow());
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what you're trying to test here, but 'TEXT' can't be the same as the return value of getTimeNow(), which is the current time stamp, so the tests are failing.

Comment on lines +124 to +125
if (!is_numeric($expires)) {
$expires = intval($expires);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this check is useful. If something is not numeric, it usually won't have an intval worth using.

For example: https://3v4l.org/9r3Wj

ramsey pushed a commit that referenced this pull request Dec 11, 2024
@ramsey
Copy link
Contributor

ramsey commented Dec 11, 2024

Merged to the master branch in 8cee80a

Thank you for contributing! 🎉

@ramsey ramsey closed this Dec 11, 2024
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