Ok, with register globals on, this works ('order' being a php object):

    session_name('name');
    session_register('order');

    $order->print_something();

With with register globals off, this fails:
    session_name('name');
    $order = $_SESSION['order'];

    $order->print_something();

Get the errors:
    PHP Notice:  Undefined variable:  _SESSION
    PHP Fatal error:  Call to undefined function:  print_something()
Meaning the _SESSION arr is not recognized and the $order obj variable has
not been passed. 

What am I missing?




> PHP Manual:
> 
> If register_globals is enabled, then each global variable can be registered
> as session variable. Upon a restart of a session, these variables will be
> restored to corresponding global variables. Since PHP must know which global
> variables are registered as session variables, users need to register
> variables with session_register() function. You can avoid this by simply
> setting entries in $_SESSION.
> 
> 
> 
> just set the superglobal to the desired value. to remove when you're through
> you can use session_unregister('foo') or unset($_SESSION['foo']). do not
> unset $_SESSION itself!!!
> 
> $_SESSION['foo'] = "bar";
> 
> ~pj
> 
> 
>> I've looked through the docs and past posts but I'm still a bit confused.
>> How do I translate the following into code that can be used with
>> register_globals set off.
>> 
>> Assuming there's a preceding page that has created the session 'name' and
>> registered the var 'order' with the 'name' session.
>> 
>> 
>> session_name('name');
>> session_register('order');
>> 
>> 
>> -- 
>> Randall Perry
>> sysTame
>> 
>> Xserve Web Hosting/Co-location
>> Website Development/Promotion
>> Mac Consulting/Sales
>> 
>> http://www.systame.com/

-- 
Randall Perry
sysTame

Xserve Web Hosting/Co-location
Website Development/Promotion
Mac Consulting/Sales

http://www.systame.com/

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

Reply via email to