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

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.