Re: Completely stumped (still) [message #185073 is a reply to message #185068] |
Tue, 25 February 2014 20:39 |
Richard Yates
Messages: 86 Registered: September 2013
Karma:
|
Member |
|
|
On Tue, 25 Feb 2014 20:27:59 +0100, Christoph Michael Becker
<cmbecker69(at)arcor(dot)de> wrote:
> Jerry Stuckle wrote:
>
>> On 2/24/2014 6:53 PM, Richard Yates wrote:
>>>
>>> I inserted var_dump successively at each stage in the script to see
>>> where it changes from the (correct) array to a (incorrect) string. I
>>> narrowed it down to ONE statement, but cannot see how that could
>>> possibly change the variable. Here's the section with var_dump, then
>>> the one statement, and then the var_dump repeated exactly.
>>>
>>> var_dump($_SESSION['to']);
>>> $to=$_SESSION['to'][$ct]['email'];
>>> var_dump($_SESSION['to']);
>>>
>>> The output of the two var_dumps is:
>>>
>>> The first:
>>> array(1) { [0]=> array(3)
>>> { ["fname"]=> string(4) "Dick"
>>> ["lname"]=> string(5) "Yates"
>>> ["email"]=> string(23) "dyates(at)salemharvest(dot)org" }
>>> }
>>>
>>> The second:
>>> string(23) "dyates(at)salemharvest(dot)org"
>>>
>>> If I comment out the second line (that sets $to), the second var_dump
>>> comes out correct. Am I losing my mind?
>>>
>>>
>>
>> The failing server has register_globals enabled.
>
> I'm still confused that it seems that register_globals makes the
> respective global variables *references* to the session variables. If
> that is so, register_globals is even far worse a feature than I thought.
From what I have been able to glean from forums it can be a
nightmare. I found this bit on StackOverflow:
$_SESSION[x] = 123;
$x = 'asd';
echo $_SESSION[x];
The output will be asd if register_globals is on.
I was doing the equivalent of $x=$_SESSION['x'] for the second line
which made it a double whammy. It seemed reasonable, tidy and easy to
keep track of to use the same name for the regular variable as the
_SESSION variable. I do that with _GET and _POST sometimes, too. At
least it turned out to be easy to turn register_globals off once Jerry
had pointed me there.
|
|
|