Skip to content

Resolve SessionStore::purge() not iterating over session storage when a falsey value is stored#577

Merged
evansims merged 1 commit intomainfrom
fix-session-purge
Oct 16, 2021
Merged

Resolve SessionStore::purge() not iterating over session storage when a falsey value is stored#577
evansims merged 1 commit intomainfrom
fix-session-purge

Conversation

@evansims
Copy link
Copy Markdown
Contributor

@evansims evansims commented Oct 15, 2021

Changes

Background: When a developer invokes the purge() method on whatever session handler is configured, the chosen session class is expected to clear our the local user session. Developers using the PHP native sessions handler for storage will have the PHP global $_SESSION iterated over and parsed for keys prefixed with the SDK's namespace, which are then deleted.

Bug: This PR addresses an issue in which PHP's language feature current() will return false when a falsey value is stored in the PHP native session key-store, causing the iteration check of while(current(...)) to exit early.

Fix: The key() feature functions as a suitable drop-in replacement for this check without the falsey value issue, allowing the SDK to successfully clear our a user's local session when the developer is using native PHP sessions that contain falsey values.

References

Resolves #576

Testing

No additional/new testing was necessary for these changes. Coverage remains at 100%.

Contributor Checklist

@evansims evansims added this to the 8.0.2 milestone Oct 15, 2021
@evansims evansims marked this pull request as ready for review October 15, 2021 12:53
@evansims evansims requested a review from a team as a code owner October 15, 2021 12:53
@lbalmaceda
Copy link
Copy Markdown
Contributor

lbalmaceda commented Oct 15, 2021

current() will return false when a falsey value is stored in the PHP native session key-store, causing the iteration check of while(current(...)) to exit early.

Should this be test-covered to verify that the introduced diff fixes that?

@evansims evansims merged commit 5bdf73d into main Oct 16, 2021
@evansims evansims deleted the fix-session-purge branch October 16, 2021 23:33
@evansims evansims mentioned this pull request Oct 18, 2021
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fail to purge auth session keys

2 participants