php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31483 session_name() ignored in cookie
Submitted: 2005-01-11 00:42 UTC Modified: 2006-06-25 19:01 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: andy at andycc dot net Assigned:
Status: Closed Package: Session related
PHP Version: 4.3.10 OS: Redhat Linux Fedora 1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: andy at andycc dot net
New email:
PHP Version: OS:

 

 [2005-01-11 00:42 UTC] andy at andycc dot net
Description:
------------
php 4.3.10 configured with --with-mysql --with-apxs

When using your own session_name to call the cookie, PHP ignores it the first time round, as in:

<?php

session_name("thisSession");
session_start();

?>

You have to set your session_name, start the session, destroy the session, and start a new one to get it to recognise your name.

The cookie is still called "PHPSESSID" (the default in php.ini) the first time round, but is ok the second.

The first code worked fine in 4.3.9.

Reproduce code:
---------------
<?php

session_name("thisSession");
session_start();

?>


Expected result:
----------------
A cookie called "thisSession" to be present in the browser.
(Using Mozilla Firefox, can view the cookie names.)



Actual result:
--------------
A cookie called "PHPSESSID" is present, but no "thisSession" cookie.

You have to use the following to destroy the session and set it properly.

<?php

session_name("thisSession");
session_start();
session_destroy();
session_start();

?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-13 18:22 UTC] andy at andycc dot net
Doesn't work with session.bug_compat_42 disabled either (as advised in the error log.)
 [2005-01-17 21:41 UTC] andy at andycc dot net
Yep works, thanks!
 [2005-01-17 21:43 UTC] andy at andycc dot net
Solved.
 [2006-06-25 19:01 UTC] andy at andycc dot net
changed e-mail address
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 17:01:29 2024 UTC