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

Verify that any existing session path is correct and avoid trying to … #855

Closed
wants to merge 1 commit into from

Conversation

EreMaijala
Copy link
Contributor

…set an empty path for the session cookie.

We have cases where there is a common VuFind instance in domain root and sub-instances in subdirectories. Currently, if a user enters the common instance first, he'll get a session cookie with '/' as the path, and it will also be used for the sub-instances. This causes trouble when e.g. login methods differ between the instances. Since the cookie headers a browser sends don't include information on the cookie path, this PR adds storing of the path to the session and verification of its correctness. This of course applies in practice only when [Session] limit_by_path is enabled.

The other small change is to ensure that an empty path is never used, otherwise Zend will throw an InvalidArgumentException. That would have happened with VuFind installed in domain root with limit_by_path enabled.

@EreMaijala
Copy link
Contributor Author

EreMaijala commented Nov 14, 2016

Note: unfortunately it seems there's no equivalent for session_unset() in ZF's SessionManager, and session writes are temporarily disabled when creating a new session since PHP's documentation says PHP 7 will write the old session on session_regenerate_id().

@demiankatz
Copy link
Member

Looks reasonable to me; I've backported to release-3.1.

@demiankatz demiankatz closed this Nov 16, 2016
@EreMaijala EreMaijala deleted the session-cookie-path branch December 29, 2016 08:56
olli-gold added a commit to tubhh/vufind that referenced this pull request May 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants