Re: Weird sessions problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jason Wong wrote:

> On Sunday 28 November 2004 22:46, steve wrote:
> 
>> I tried printing out the values before and after each of those lines.
>> After line 53, $ref_page is an array containing precisely the values I
>> expect, so the function is working. After line 54, the session var has
>> been reset, as expected, to match the current page - but $ref_page has
>> also changed and is now equal to $_SESSION['ref_page'], which is what I
>> found very weird - ie, resetting $_SESSION['ref_page'] simultaneously
>> reset $ref_page.
> 
> Is $ref_page getting set to what the _previous_ value of
> $_SESSION['ref_page'] was? If so, it sounds like you have register_globals
> enabled.

No to both. When I arrive at the new page, the sessions vars (as expected)
contain the values set by the previous page. $ref_page is not set. The
values are transferred to $ref_page by the function. That works as planned.
I then reset the value of the session vars, at which point, $ref_page also
gets set. From printing out the values after each line, I find this:

Let's say we've come from the page /community.php and have arrived
at /market.php. Here are the values at each stage:

            $_SESSION['ref_page] = '/community.php'
            $_SESSION['ref_pagequery'] = 'pagemode=index' // as an example
53. $ref_page = get_ref_page();
            $ref_page['name'] =  '/community.php'
            $ref_page['query'] = 'pagemode=index'
            $_SESSION['ref_page] = '/community.php'
            $_SESSION['ref_pagequery'] = 'pagemode=index'
54. $_SESSION['ref_page'] = THIS_PAGE;
            $ref_page =  '/community.php' // now a scalar
            $_SESSION['ref_page] = '/market.php'

register_globals is off (in php.ini and there are no .htaccess files). 

-- 
@+
Steve

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux