Re: PHP 4.0 Bug #5152: Object passed in a session generateserrors when member functions are called
| From: | Sascha Schumann | Date: | Thu, 22 Jun 2000 10:57:37 +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-21953@lists.php.net to get a copy of this message | ||
On Wed, 21 Jun 2000, Shane Caraveo wrote:
>
>
> Sascha Schumann wrote:
> >
> > On Wed, 21 Jun 2000, Shane Caraveo wrote:
> >
> > > > We agree on:
> > > >
> > > > - PHP needs to preserve the name of the class of a
> > > > serialized object, even if the class definition is not
> > > > available during deserialization.
> > >
> > > Why agree on that?
> > >
> > > > We do not agree on:
> > > >
> > > > - PHP must stop script execution and output a misleading
> > > > error message, if the script defines a class and if this
> > > > class was absent on one or more object instantiations.
> > >
> > > Why not agree on this?
> >
> > Because throwing a misleading error message is not
> > appropiate. The mailing lists are full of recurring
> > questions. We want to avoid that.
>
> Missleading errors are fixable, to provide more acurate error messages.
If a user defines a class after the deserializer did, Zend
will output "Class foo was defined twice." How do you propose
to fix that?
> It could be optimized futher, just use one function for the vars:
>
> session_var($sid, $myclass, "MyClass");
>
> This would either get the session variable "MyClass", or create a new
> one, in either case assigning it to $myclass, and registering the class
> to be serialized at the end of the request.
While your proposal exactly solves my constructed scenario,
I'd prefer a broader approach to this problem which avoids
any unnecessary complexity (and changes in the session user
interface). We already have two proposals which limit their
impact to the serializer (in ext/standard/var.c) and which
are transparent to the end-user.
- Sascha