RE: [PHP] Object in session and include
| From: | chris dot neale at somerfield dot co dot uk | Date: | Wed, 17 Sep 2003 11:54:29 +0000 |
| Subject: | RE: [PHP] Object in session and include | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-162852@lists.php.net to get a copy of this message | ||
I was under the impression that if you used include_once then the script
would only include the class definition if it was required within the
script.
You might want to check the manaul or get a second opinion on that, but
that's what I've always done.
Regards
Chris
-----Original Message-----
From: Marco Schuler [mailto:marco.schuler@scopein.ch]
Sent: 17 September 2003 10:45
To: php-general@lists.php.net
Subject: [PHP] Object in session and include
Hi
I have to serialize an object in a session. Generally there is no
problem with this if the class-definition file(s) are included _before_
starting the session, as explained in the php-manual:
<quoting>
It is strongly recommended that you include the class definitions of
all such registered objects on all of your pages, even if you do not
actually use these classes on all of your pages. If you don't and an
object is being unserialized without its class definition being present,
it will lose its class association and become an object of class
stdClass without any functions available at all, that is, it will become
quite useless.
</quoting>
I am using PEAR classes for my project. If I want to store such an
object in a session, I would have to include all the class-definitions
that are included within the class that I am using. There can be a lot
of included classes or also dynamically incldued classes.
Has somebody got an idea or an acceptable solution to handle this
without including all the class-definitions?
--
Cheers!
Marco
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield. Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.