|
Posted by Erwin Moller on 01/18/07 13:30
Rik wrote:
> drako wrote:
>
>
> Don't fix bottom-posting, fix topposting.....
>
>> Kimmo Laine wrote:
>>> "drako" <neil@invidion.co.uk> wrote in message
>>> news:1169067038.010143.224210@a75g2000cwd.googlegroups.com...
>>>> OK,
>>>>
>>>> I inserted the debugging statements as you suggested:
>>>>
>>>>
>>>> $_SESSION["increment"] = array();
>>>> echo '1: ';print_r($_SESSION["increment"]);echo '<br>';
>>>>
>>>> $x = 0 // Counter - This will be
>>>> incremented
>>>> echo '2: ';print_r($increment); echo '<br>';
>>>
>>> I don't understand what this $increment variable has to do with
>>> anything.
>>
>> It doesn't actually relate to anything; but I suspect it was
>> suggested just to see if anything was output - and nothing was output.
>>
>> I know if 'register_globals' is switched on, this could potentially
>> cause a problem, but in this case, globals is switched off, so is not
>> the problem.
>>
>> I now suspect this is session-related in someway. As the code looks
>> OK, the problem arises from elsewhere....
>
> Nope.
> Keep in mind, that on strings, the [] will get or set the character of the
> string at that particular location. My suspicion is that you don't give us
> the real code (for where would the incrementation take place?), and you
> turn the array into the string ( or number) '1' somewhere. (This often
> happens when you use the return of a function (true) that works be a
> reference instead of a return by accident.)
>
> So, in the first loop, we've made $_SESSION["increment"] into a string by
> accident. On the second loop, if $x = 1, that's the second position in
> the string (which was not previously set). You try to set a character to
> an array, so the array is converted to a string ('Array'), then it takes
> the
> first character ('A') from that string, and put it at position 1. Hence
> resulting in '1A'.
>
> If you gave us the real code, I'd bet we'd spot where the actual
> overriding on $_SESSION["increment"] takes place.
Damn Rik, sometimes you are scaringly smart.
That sounds like a very probable scenario you described and deducted from
the sparse information given.
Respect!
Erwin Moller
[Back to original message]
|