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

Cannot set session cookie parameters for already started session #134

Closed
wants to merge 2 commits into from

Conversation

@mabar
Copy link
Contributor

mabar commented Mar 6, 2018

  • bug fix? yes
  • new feature? no
  • BC break? probably not

Fixes Warning session_set_cookie_params(): Cannot change session cookie parameters when session is active
It happens when Session::setOptions() is called multiple times.
Can be tested with php 7.2+ only. In previous versions it failed silently (see https://bugs.php.net/bug.php?id=75650&thanks=2)

@dg dg force-pushed the nette:master branch 2 times, most recently from 898e948 to b550f69 Mar 8, 2018
dg added a commit that referenced this pull request Mar 14, 2018
@dg dg closed this in b395717 Mar 14, 2018
dg added a commit that referenced this pull request Mar 14, 2018
…hanged [Closes #134][Closes #23]
dg added a commit that referenced this pull request Mar 14, 2018
dg added a commit that referenced this pull request Mar 14, 2018
…hanged [Closes #134][Closes #23]
dg added a commit that referenced this pull request Mar 14, 2018
@mabar

This comment has been minimized.

Copy link
Contributor Author

mabar commented Apr 13, 2018

@dg Thanks but nothing changed :(
It makes no sense to call session_name($name) or session_set_cookie_params() twice during one request even if parameters was changed.

@dg

This comment has been minimized.

Copy link
Member

dg commented Apr 14, 2018

Why not?

@mabar

This comment has been minimized.

Copy link
Contributor Author

mabar commented Apr 14, 2018

My previous statement is not exact.

  • It makes no sense to call session_name or session_set_cookie_params() after session_start()
    It throws warning everytime in php 7.2 (and fails silently in previous versions).
<?php
error_reporting(E_ALL);
session_start();
session_name('foo');
session_set_cookie_params(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.