php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16389 session_name doesnt work as expected
Submitted: 2002-04-02 05:57 UTC Modified: 2002-04-03 10:47 UTC
From: assid at assid dot com Assigned:
Status: Closed Package: Session related
PHP Version: 4.1.2 OS: Linux
Private report: No CVE-ID: None
 [2002-04-02 05:57 UTC] assid at assid dot com
session_name is supposed to get/set the session name.
So basically if i have a session variable which is registered under a particular session name and a session id i should be able to propogate it across any subdomain.

Now heres the real problem
i have a domain.com which works on eisessid as its session name and i have abc.domain.com which i am trying to access the session information.

When i set session_name to eisessid i do not get the information of that session(from within my php script). However, when i put session.name as eisessvar in my .htaccess of abc.domain.com i am able to retrieve the information.

Since session_name is supposed to set/get the name of the session and i am propogating the session id to work, shouldnt session_name from within my code be able to access the session variables ? instead of having to only do it from .htaccess ?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-02 06:19 UTC] assid at assid dot com
i almost forgot session_name also returns eisessid if i set it from my script but doesnt return any session variable info. But using .htaccess it yet returns eisessid as session name but this time it returns the session variable info as well. (both cases session_id remains the same).
 [2002-04-02 06:34 UTC] assid at assid dot com
Okay i was playing around some more..
I found that if i set some other session name into .htaccess i can yet retrieve information from my actual session variable (eisessid). but if i dont add anything into .htaccess (default being phpsessid) it doesnt seem to work.
 [2002-04-02 08:30 UTC] yohgaki@php.net
Could you paste short and complete script?
 [2002-04-03 06:31 UTC] assid at assid dot com
try this, but try across subdomains.
.htaccess for sub1

php_value session.name eisessid
php_value session.auto_start 1
php_value session.save_path /home/blah/tmp
php_value session.cookie_domain .blah.com

now make a script and add a session variable... just register anything...

now make a replica of this .htaccess for sub2 but remove session.name directive.

now in sub2 try to access the session variable of sub1 you wont be able to. add the session_name into your script (not .htaccess) and try again.. and ofcourse the session_id.. yet wont work

now in .htaccess add the session.name directive and set it to blahsessid and in the sub2 page, set session_name to eisessid so u can access sub1's sessvar. you should be able to do it now. even if u change .htaccess to eisessid it will work

this shows u can access the session variable of another sub only if there is a directive for session.name in .htaccess even tho the session name is different. but otherwise without this directive it just wont work.
 [2002-04-03 09:03 UTC] yohgaki@php.net
You are starting session automatically. Then you cannot change session name with session_name(). (I've commited warning patch before but it's reverted)

PHP does not raise any error and it does work. It's not nice. Don't you think so ;)

BTW, when we ask script, paste script even if it _very_ simple. There are many cases that no one cannot be sure if it's bug or user error w/o script.

It seems there is other issue in your report also. 


 [2002-04-03 09:42 UTC] yohgaki@php.net
I think other issue is fixed in 4.2.0RC1. 
Visit http://qa.php.net/ for 4.2.0RC1.

Please reopen if you still have problem.
Thank you.
 [2002-04-03 10:28 UTC] assid at assid dot com
the first time i tried it was without .htaccess for sub2
so that wasnt on auto start. 

My whole report is basically to state that without session.name in .htaccess it just didnt work.
 [2002-04-03 10:47 UTC] yohgaki@php.net
If you really think this is a bug, you need to paste some script and it's setting here to demonstrate bug. It sounds like there is your error (there may not) and I don't see what is exact problem yet.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 22 21:00:03 2025 UTC