At 2:11 PM +0100 8/16/08, Stut wrote:
Ahh, I see the problem. You've never been able to use numbers as keys at the root level of the $_SESSION array. It's not a bug, it's just the way it is. I've just checked the documentation and can't find an obvious reference to this limitation which is kinda annoying.

I agree.

But what I find even more annoying is:

1) No error is generated.

2) The error prohibits ALL other SESSION variables legally declared after the error to stop working!

In other words, if you make the mistake of using a numeric index for a SESSION, then ALL legal SESSIONs declared after that will stop working. And, what makes this even more frustrating is that ALL SESSIONs declared before will continue to work. IMO, it would be better if once you screwed it up, then everything would stop working.

So, let's say this happens (as it did to me last year), you have a set of scripts that work fine and in one script you use a numeric index for a SESSION. Once that statement is encountered in the flow of the program, ALL other SESSION variables declared after that don't work anymore.

In one sequence of scripts everything worked fine and in a different sequence only some things work. That was maddening and I never knew what it was until now. And, no mention of this problem in the documentation.

This should give you a bit more ammunition for your "I never use SESSIONs for anything" argument.

--- you further stated

I would question why you would want to do such a thing.

You have never moved data between arrays?!? Come on, I'm sure you have done it before.

It's an old habit I have filling arrays -- I never had any problems using numbers before.

This works:

for ($i; $i<10; $i++)
   {
   $things[$i] = $other_things[$i];
   }

I was looking at SESSION the same way -- after all it IS called an array.

Let me play the age-card -- in every language I've programmed in for the last 43 years an array can have numeric indexes -- except php's SESSION.

Thanks for your comments.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to