From: cameron dot brunner at gmail dot com
Operating system: Gentoo Linux
PHP version: 5CVS-2006-12-05 (CVS)
PHP Bug Type: Session related
Bug description: session_start() doesnt check if there is a duplicate cookie
Description:
------------
php seems to fail to check if there is already a setcookie for the session
in the queue and puts the same thing in again
Reproduce code:
---------------
<?php
ob_start();
session_start();
$id = session_id();
$_SESSION['asdf'] = 123;
var_dump($_SESSION);
session_write_close();
$_SESSION['asdff'] = 234;
var_dump($_SESSION);
session_start($id);
$_SESSION['a'] = 'b';
var_dump($_SESSION);
session_write_close();
var_dump($_SESSION);
Expected result:
----------------
X-Powered-By: PHP/5.2.1-dev
Set-Cookie: PHPSESSID=h00e0fl7o9ilgifoluqh8kdbg1; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache
Content-type: text/html
array(1) {
["asdf"]=>
int(123)
}
array(2) {
["asdf"]=>
int(123)
["asdff"]=>
int(234)
}
array(2) {
["asdf"]=>
int(123)
["a"]=>
string(1) "b"
}
array(2) {
["asdf"]=>
int(123)
["a"]=>
string(1) "b"
}
Actual result:
--------------
X-Powered-By: PHP/5.2.1-dev
Set-Cookie: PHPSESSID=h00e0fl7o9ilgifoluqh8kdbg1; path=/
Set-Cookie: PHPSESSID=h00e0fl7o9ilgifoluqh8kdbg1; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache
Content-type: text/html
array(1) {
["asdf"]=>
int(123)
}
array(2) {
["asdf"]=>
int(123)
["asdff"]=>
int(234)
}
array(2) {
["asdf"]=>
int(123)
["a"]=>
string(1) "b"
}
array(2) {
["asdf"]=>
int(123)
["a"]=>
string(1) "b"
}
--
Edit bug report at http://bugs.php.net/?id=39739&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39739&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39739&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39739&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39739&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39739&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39739&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39739&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39739&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39739&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39739&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39739&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39739&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39739&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39739&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39739&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39739&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39739&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39739&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39739&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39739&r=mysqlcfg