"Randall Perry" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> Solved my main problem. I was assuming that variables registered with
> $_SESSION were passed by reference. Apparently they're passed by value.

Wouldn't make very much sense to pass by reference, would it? Seems to me
like that would kill all values after the script finish... The logic would
be the reverse, to make $order a reference to $_SESSION['order']... Oh, and
have a look at serialize().. :)

> I moved the line '$_SESSION['order'] = $order;' from the top of the page 1
> php code (before any properties for the order object are set), to the end
of
> the php code -- now everything's getting passed to page 2 ok.
>
> This is an important point that should probably be in the docs section on
> sessions.
>
> When I coded using session_register() with register_globals on registering
> the variable before making changes to it worked.
>
> The '[error] PHP Notice:  Undefined variable:  _SESSION' happened, I
think,
> because there were no session variables to pass so PHP killed the session.
>
That sound VERY wierd to me.. But possible I guess..
>
> > Had a previous thread on this issue. Started working on it again and am
> > running into new bugs, so thought I'd start a new thread.
> >
> > Read thoroughly through session examples in docs and here's how I tried
to
> > pass an object from one page to another:
> >
> >
> > page 1
> > ______
> >
> > // include class definition file
> > include_once "order_classes.php";
> > // start session
> > session_start();
> > // create instance of class Order
> > $order = New Order();
> > // assign class instance to $SESSION[]
> > $_SESSION['order'] = $order;
> >
> > page 2
> > ______
> >
> > // include class definition file
> > include_once "order_classes.php";
> > // start session
> > session_start();
> > // assign $_SESSION['order'] object to variable
> > $order = $_SESSION['order'];
> >
> >
> > I'm getting the following error when page 2 loads:
> > [error] PHP Notice:  Undefined variable:  _SESSION
> >
> > Any ideas?
> >
> >
> >
> >
> >
> > Pertinent PHP vars:
> > ___________________
> >
> > Darwin systame.cniweb.net 7.2.0 Darwin Kernel Version 7.2.0: Thu Dec 11
> > 16:20:23 PST 2003; root:xnu/xnu-517.3.7.obj~1/RELEASE_PPC Power
Macintosh
> >
> > Build Date Apr 2 2004 12:58:17
> >
> > Configure Command  './configure' '--with-apxs=/usr/sbin/apxs'
'--with-pgsql'
> > '--with-xml' '--with-openssl=/usr/local/ssl' '--with-pear'
> > '--with-curl=/usr/lib'
> >
> > Apache/1.3.29 (Darwin) DAV/1.0.3 mod_perl/1.29 PHP/4.3.5 mod_jk/1.2.4
> > mod_ssl/2.8.16 OpenSSL/0.9.7c
> >
> > register_globals        Off     Off
> >
>
> -- 
> 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