Re: PHP 4.0 Bug #5152: Object passed in a session generates errors when member functions are called
| From: | Stanislav Malyshev | Date: | Wed, 21 Jun 2000 18:38:05 +0000 |
| Subject: | Re: PHP 4.0 Bug #5152: Object passed in a session generates errors when member functions are called | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-21927@lists.php.net to get a copy of this message | ||
>> i'm for the class-on-demand creation. i don't think that this
>> will cause any problems. is you include your classs code
>> after session_start() you'll get a "cannot redeclare
>> class-name" this way. (this would also be this 1st step into
>> creating a class-on-demad loading mechanism)
Yes. And you sit here and wonder for 2 hour where the hell it was defined
first time. Too bad. This would work for one (quite vocal) person,
refusing to learn to do things the right way, and break OO model for all
the rest. What for?
>> if we go with sascha's way (remembering the class-name
>> somewhere) you will be able to create a new class but your
>> sessionized object wouldn't be able to call the methods.
I thought about it and I think solution could be having some "class
translation" table internally in the session, and when you are
unserializing, remember that you had class Foo which was substituted by
stdClass_Foo, and when you are saving it, substitute it back. THis still
won't get you access tyo class methods (and shouldn't get - without
properly defining class), but this way you could at least transiently
ignore this object. I guess Sacha's idea was something along these lines?
--
Stanislav Malyshev stas@zend.com
+972-3-6139665