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: CacheBridgeAbstract::save() not assigning value to cache when cache hit mises #434

Merged
merged 3 commits into from
Dec 7, 2023

Conversation

seruymt
Copy link
Contributor

@seruymt seruymt commented Nov 24, 2023

Changes

This PR updates cache save value.
According to the Auth0\Laravel\Bridges\CacheItemBridgeAbstract::get(), the item value always returns null because isHit() is false til the value is cached, and as a result, the cache is not working properly.

    final public function get(): mixed
    {
        return $this->isHit() ? $this->value : null;
    }

So for cache save function, we need to use getRawValue(), which is not dependent on hit status.

References

Testing

Contributor Checklist

Signed-off-by: Sergey Mutaf <seruymt@gmail.com>
@seruymt
Copy link
Contributor Author

seruymt commented Nov 29, 2023

@evansims can you check it, please?

@evansims
Copy link
Member

@seruymt I am currently tasked on other priorities right now, but will review as soon as I'm able. Thanks for your contribution.

@evansims evansims changed the title Fixed item cache value fix: CacheBridgeAbstract::save() not assigning value to cache when cache hit mises Dec 7, 2023
Copy link

codecov bot commented Dec 7, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a53f05c) 100.00% compared to head (8b65933) 100.00%.

Additional details and impacted files
@@             Coverage Diff             @@
##                main      #434   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity       523       523           
===========================================
  Files             31        31           
  Lines           1294      1294           
===========================================
  Hits            1294      1294           
Flag Coverage Δ
unittestsvalidate 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@evansims evansims left a comment

Choose a reason for hiding this comment

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

Hi @seruymt 👋 Thanks for your contribution. I've updated the test suite to pass with the changes.

@evansims evansims added the Scope: Bug Confirmed report of unexpected problems or unintended behavior. label Dec 7, 2023
@evansims evansims enabled auto-merge (squash) December 7, 2023 07:55
@evansims evansims merged commit 30aafed into auth0:main Dec 7, 2023
24 checks passed
@evansims evansims mentioned this pull request Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Bug Confirmed report of unexpected problems or unintended behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants