Receiving odd warning when trying to use a named session

I’ve run up against a very strange problem with using session_name in a script I’m using. The details are as follows:

PHP code:

$sid = getSessionId('POST'); // simply obtains the current session id, returning empty if it doesn't exist
if (empty($sid)) {
  $sid = session_id();

relevant php.ini entries:

session.save_path = "D:\\GCC\\mySessions" = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 86400
session.cookie_path = /

; Select a hash function
; 0: MD5   (128 bits)
; 1: SHA-1 (160 bits)
session.hash_function = 0 

; 4 bits: 0-9, a-f
; 5 bits: 0-9, a-v
; 6 bits: 0-9, a-z, A-Z, "-", ","
session.hash_bits_per_character = 6

Now for the symptoms:

When I set the session name as listed above, I get:

Warning: session_start() [function.session-start]: The session id contains illegal characters, valid characters are a-z, A-Z, 0-9 and ‘-,’ in D:\GCC\pChat\loginData.php on line 6

However, different name settings do not cause the error. I know that the “simple” fix here would be to use a name that doesn’t throw the error, but that doesn’t answer the “why” aspect of this problem. Listed below are names I’ve used, and whether or not they tossed a warning:

pchatlogin : no warning
pChatlogin : no warning
pChatLogin : warning
pChatKogin : no warning
pchatLogin : no warning
ChatLogin : no warning

I’ve deleted all cookies, in the off chance that there’s a bad cookie, but to no avail. I’m pretty certain I’m missing something here, but not sure what.

Any ideas, folks?

Ok, Time for that dreaded “OOPS?”

And it’s time to update my local copy of my PHP manual. I just read the online version, and it states, much more clearly that the comma is, indeed, a legal character. Duh! After reading the online version, I went back and read mine again, and it DOES indicate this, but it’s VERY poorly worded, and this was the source of my mistake. Sorry, all. :slight_smile:

Of course, this doesn’t “fix” the original problem, so I’m still at a loss there…

I see that, even after three weeks, nobody seems to have a clue here. Well, I’ll go one better. Here’s some code that seems to illustrate the problem on my dev box:

$sessionid = session_id();
print "sessionid = $sessionid<br>\

The output for the above, using Firefox 3.6.7, is:
sessionid = 7049E,DuFboUcpbOcnVG40

Please note the comma in the session id. This problem occurs while using the following browsers:
Opera 10.60 (sessionid = wFnXbNZsPk6lTssxkj7,e1)
Safari 4.0.3 (sessionid = r5nAvKPb7oLUU8sZ,b-pW3)

I’m certain that if I spent enough time clearing cookies and retrying that I could get similar results in IE, and other browsers, too.

Now, try as I might, I can’t reproduce the error on my live server, so I’m suspecting either a bug in my particular version of PHP on my dev box, or perhaps a corrupted installation.

Further info that I should have included in my original post:

OS: Win XP Pro SP3
PHP version: 5.2.10

Opinions? Ideas? Suggestions? Anything?