Problems with PHP4 and PHP5 sessions not working? … you may be using numeric keys!

March 27th, 2008

I have just blown 4 - 5 hours on this “feature” of PHP and I thought someone else would care to know.

You can’t use numeric keys for sessions in php!

so stuff like

$_SESSION['1234']  = ‘boo”;

… won’t work because PHP’s session handling mechanism simply refuses to store that particular session variable.

Even worse, it fails silently, leading you to think your brain has fried itself.

Personally, I just thought something funky was up with PHP5 (google searches seemed to indicate problems with PHP5 sessions, so I focused on that).

But after trying version 5.2.4, 5.1.6  and still having the same problem I finally tried it out in PHP4 and … still had the problem. Then I seriously started trying to track down the bug.

After finally finding it and writing the right Google query  (thanks for nothing Google :|) … I found a couple of articles that point out this problem.

So I’m writing this with an SEO’ed title that should hopefully grab the right folks, before they blow hours trying to figure this out.

Please go and vote for this feature to be fixed (made to fail loudly … so you know exactly what is wrong).

Add a comment if you do.

Entry Filed under: developers, php

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="">

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

January 2009
S M T W T F S
« Dec    
 123
45678910
11121314151617
18192021222324
25262728293031

Shared Rails Hosting

Most Recent Posts

Categories