Re: [PHP4BETA] Session: objects containing objects
| From: | Kristian Köhntopp | Date: | Fri, 25 Feb 2000 12:03:07 +0000 |
| Subject: | Re: [PHP4BETA] Session: objects containing objects | ||
| References: | 1 2 3 4 5 6 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-10940@lists.php.net to get a copy of this message | ||
Boris Erdmann wrote:
> i dont semm to get your point on this: do you want to sess->register
> a *class* (see the code!)? that wont work with PHPLIB and php4 either.
Registering an object (a class instance) makes it necessary
for the receiving interpreter to know about the class definition,
i.e. to have the code for the methods associated with that
objects class.
Registering a class can only be done by exporting the
code that compromises the class. This can be done on
source level only in PHP3, as there is no "compiled"
representation for classes. It also requires that a
file contains only the definition of a single class.
There is some session management library other than
PHPLIB which tries to implement such an autoload feature,
but I do not remember the name of that project at the moment.
In PHP4, registering a class could mean to compile
classes into bytecode and serialize the class by
storing and shipping the bytecode representing that
class. That way, the receiving system imports the
class and can create instances of that class. The
"shipping source" approach from PHP3 is still valid.
So the current state of affairs with PHP4 seems to
be:
- PHP4's serializer is at least en par with the PHPLIB
serializer, obsoleting the Session class in PHPLIB.
- PHP4's serializer and PHPLIB's serializer both require
that the class definitions for all classes that are to
be unserialized are known in the receiving interpreter
at unserialization time.
- There is no autoload mechanism and no method to serialize
bytecode, so there is no mechanism to serialize classes,
only objects which are (manually) dependent on the
presence of the appropriate object definition.
This is not perfect, but perfectly acceptable.
Kristian
--
Kristian Köhntopp, NetUSE Kommunikationstechnologie GmbH
Siemenswall, D-24107 Kiel, Germany, +49 431 386 436 00
Using PHP3? See our web development library at
http://phplib.netuse.de/ (We have moved! Update your
bookmarks!)