php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1988 <?=sid?> doesn't reflect session_name("newname") change
Submitted: 1999-08-07 13:25 UTC Modified: 1999-08-07 13:29 UTC
From: kovacsp at egr dot uri dot edu Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0 Latest CVS (07/08/1999) OS: Linux 2.2.9
Private report: No CVE-ID: None
 [1999-08-07 13:25 UTC] kovacsp at egr dot uri dot edu
<?
session_start();
        echo "\nSession name: " . session_name();
        echo "\nSetting session name to blah";
session_name("blah");
        echo "\nSession name now: " . session_name();
?>        
        
<?=sid?>

Produces this output:

Session name: PHPSESSID
Setting session name to blah
Session name now: blah
PHPSESSID=8beb119ba14466d03261957ebea8d853

PHP4 running as dynamic apache module compiled with the following parameters:
./configure  --with-apxs=/usr/bin/apxs --with-mysql

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-08-07 13:29 UTC] sas at cvs dot php dot net
Once a session is started, either explicitly through session_start() or implicitly through session_register(), the name of the session cannot be changed anymore. More correctly, the name change is not reflected in anything which is performed during session start (e.g. defining sid).

Therefore put session_name() before session_start() and you are fine.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 23:01:30 2024 UTC