Re: PHP 4.0 Bug #5152: Object passed in a session generateserrors when member functions are called
| From: | Rasmus Lerdorf | Date: | Thu, 22 Jun 2000 21:56:49 +0000 |
| Subject: | Re: PHP 4.0 Bug #5152: Object passed in a session generateserrors when member functions are called | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-21999@lists.php.net to get a copy of this message | ||
> RL>> $a = 123;
> RL>> echo serialize($a);
> RL>>
> RL>> produces: i:123;
> RL>>
> RL>> 'i' is data semantics. 123 is data.
>
> Not exactly. I don't see here code for "+" operation on integers,
> right? Neither I have here a code that says me "i" is really loop
> counter. Class definition has all such things inside.
That's because you can think of them as a user-defined data type. The 'i'
data type is a standard data type with the manipulator functions built
into PHP. I really don't see why it is a bad idea to tie object data to
its originating class definition. This doesn't mean that it will
necessarily be in the serialization. Perhaps the serialization would look
like this:
O:3:"foo":"file://foo.inc":1:{s:1:"a";i:124;}
where file://foo.inc is a resource that would have the class
definition. But having the option to also bundle it with the class
definition also seems like a useful thing to me. The argument that nobody
else does it this way doesn't really convince me that it is wrong. If it
makes life easier for the user, and it is more flexible, then I don't
really care what conventions dictate. Especially because he deserializer
could optionally choose to use the embedded class definition or not.
-Rasmus