Re: Completely stumped (still) [message #185039 is a reply to message #185036] |
Tue, 25 February 2014 00:49 |
Christoph Michael Bec
Messages: 207 Registered: June 2013
Karma:
|
Senior Member |
|
|
Richard Yates wrote:
> On Tue, 25 Feb 2014 01:11:40 +0100, Christoph Michael Becker
> <cmbecker69(at)arcor(dot)de> wrote:
>
>> 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?
>>
>> $to being a reference to $_SESSION['to'] would explain the behavior.
>
> Thanks, Christropher. In desperation I changed all instances of $to
> in the script to $tomail and it fixed the problem!
>
> But I don't understand how setting the variable: $to can affect the
> array: $_SESSION['to']? They are completely different variables.
> And why would it all work fine on other servers?
Frankly, I don't know. If I had to examine the issue, I'd probably
check the value of $to at the start of the script execution and directly
after the session start. If $to is set in either case, that would give
a hint. If $to is null at the start of the script execution, but is set
to the value of $_SESSION['to'] after starting the session, checking the
session handler would be appropriate. And if $to is already set at the
beginning of the script execution, checking the register_globals
setting[1] seems appropriate (even if that wouldn't explain the strange
behavior per se).
[1] <http://www.php.net/manual/en/ini.core.php#ini.register-globals>
--
Christoph M. Becker
|
|
|