php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75650 Why this warning? "Cannot change session name when session is active"?
Submitted: 2017-12-07 18:20 UTC Modified: 2017-12-09 17:45 UTC
From: david dot stoeckl at blackbam dot at Assigned:
Status: Closed Package: Session related
PHP Version: 7.2.0 OS:
Private report: No CVE-ID: None
 [2017-12-07 18:20 UTC] david dot stoeckl at blackbam dot at
Description:
------------
Please have a look at the following discussion: https://stackoverflow.com/questions/47700336/php-7-2-warning-cannot-change-session-name-when-session-is-active


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-12-07 18:37 UTC] spam2 at rhsoft dot net
because it never worked how you did think it worked but just silent

session_name(self::$name); // this is line 137
session_set_cookie_params(0, COOKIEPATH, null, self::$force_ssl_cookie, true);

both are nonsense when the session is already running

> according to the docs with session_name I could change sessions and start multiple sessions

where is that statet and how should that work since the session is tied to the session cookie?

> unset($_COOKIE[session_name()]);
> session_destroy();

what is that and why?
$_SESSION = array();
session_destroy();

and leave the cookie alone!
 [2017-12-09 17:45 UTC] david dot stoeckl at blackbam dot at
Well I see the problem. It is actually that it never worked like I thinked it was working. Multiple sessions acutally are created using session_id() according to this document, session_name() always means the current session.

Related: https://stackoverflow.com/questions/24964699/php-how-can-i-create-multiple-sessions
 [2017-12-09 17:45 UTC] david dot stoeckl at blackbam dot at
-Status: Open +Status: Closed
 [2017-12-09 17:45 UTC] david dot stoeckl at blackbam dot at
Closed as actually not a bug.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 08:01:28 2019 UTC