From:             andy at andycc dot net
Operating system: Redhat Linux Fedora 1
PHP version:      4.3.10
PHP Bug Type:     Session related
Bug description:  session_name() ignored in cookie

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();

?>


-- 
Edit bug report at http://bugs.php.net/?id=31483&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=31483&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=31483&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=31483&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=31483&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=31483&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=31483&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=31483&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=31483&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=31483&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=31483&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=31483&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=31483&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=31483&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=31483&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=31483&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=31483&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=31483&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=31483&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=31483&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=31483&r=mysqlcfg

Reply via email to