#38104 [Asn->Bgs]: session_start()/session_write_close() creates multiple session cookies headers
| From: | iliaa@php.net | Date: | Fri, 14 Jul 2006 20:46:11 +0000 |
| Subject: | #38104 [Asn->Bgs]: session_start()/session_write_close() creates multiple session cookies headers | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-99451@lists.php.net to get a copy of this message | ||
ID: 38104
Updated by: iliaa@php.net
Reported By: m dot v dot veluw dot smscity at gmail dot com
-Status: Assigned
+Status: Bogus
Bug Type: Session related
Operating System: any
PHP Version: 5.1.4
Assigned To: sas
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Session is created every time you call session_start(). If you
want to avoid multiple cookie, write better code. Multiple
session_start() especially for the same names in the same
script seems like a really bad idea.
Previous Comments:
------------------------------------------------------------------------
[2006-07-14 10:23:58] m dot v dot veluw dot smscity at gmail dot com
Description:
------------
When using session_start() and session_write_close() with the same
session id/name will add multiple session cookies with the exact same
contents everytime session_start is used.
This is useless overhead if it is the same.
Reproduce code:
---------------
session_name('uniqueName1');
session_start();
$_SESSION['Foo1'] = 'Bar1';
session_write_close();
session_name('uniqueName2');
session_start();
$_SESSION['Foo2'] = 'Bar2';
session_write_close();
session_name('uniqueName1');
session_start();
$sessionValue = $_SESSION['Foo1'];
print $sessionValue;
session_write_close();
session_name('uniqueName2');
session_start();
$sessionValue = $_SESSION['Foo2'];
print $sessionValue;
session_write_close();
Expected result:
----------------
just 1 session cookie header for uniqueName1.
just 1 session cookie header for uniqueName2.
Actual result:
--------------
2 session cookie headers for uniqueName1, where both are exactly the
same
2 session cookie headers for uniqueName2, where both are exactly the
same
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38104&edit=1