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 overriding INI cookie params #12

Open
braindawg opened this issue Feb 19, 2022 · 1 comment
Open

Allow overriding INI cookie params #12

braindawg opened this issue Feb 19, 2022 · 1 comment

Comments

@braindawg
Copy link

I think it'd be nice to have a well-defined mechanism to override PHP's default cookie parameters. Currently the params are retrieved by running session_get_cookie_params, and there's no way to override this behavior, so the only way to modify the cookie settings at runtime is to use something like ini_set('session.cookie_samesite', 'Strict'); (Apparently using session_set_cookie_params doesn't change the values returned by session_get_cookie_params, otherwise that'd be a more straightforward way to override these. I haven't verified that this is the case, though.)

Adding a cookie_params method taking an array would be simple, or individual methods could be added per setting so the available options are more self-documenting, but that expands the public method footprint quite a bit.

If messing with cookie params seems out of scope for the project (since it's sending cookies, it doesn't seem like it should be), adding an example to the Readme of the preferred method to set/override those parameters would be a painless solution.

@oscarotero
Copy link
Member

There's a options method to set the options to session_start. Does it work to you?

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

No branches or pull requests

2 participants