Re: PHP 4.0 Bug #5152: Object passed in a session generates errors when member functions are called

From: Date: Wed, 21 Jun 2000 17:11:54 +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-21918@lists.php.net to get a copy of this message
>> needed code) to create an empty class with the "right" name >> so that the serialized object will keep is association to the >> class and will be fully working again on the next page that >> has the code for the class available. I'd say it is Bad Thing (TM). Because you've go *no* class of this name, just a fake. This means, you are vioulating class hierarchy and you are basically create two classes with the same name in one class hieararchy. That is a bad hack. This will bite you severly if you *want* to define it but just omitted the definition - it will swallow session, create empty class and then die out of the blue on right class definition. If one wants to do such a bad hacks, one creates header file with: class Foo {} class Bar {} class Baz {} etc., etc. and include this stub whereever one wants. One can even use function that checks if class is defined in this stub. Teh stub will take neglectable time, and will do exactly the same thing without polluting PHP with kludgy side effects. Bottom line: please don't do this. This is bad hacky behaviour. In fact, even stdClass is bad hacky behavour... I'd promote that warning to error and thus forced right usage of session objects, but that could be too bondage-and-discipline... -- Stanislav Malyshev stas@zend.com +972-3-6139665

« previous php.dev (#21918) next »