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

From: Date: Thu, 22 Jun 2000 19:37:03 +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-21975@lists.php.net to get a copy of this message
> When the class/object is deserialized, if it is not already defined, > throw an error at that time. Right now, it just changes it to stdclass > and goes on. That is contradictionary to your last email where you proposed a solution which allowed users to leave classes undefined. > But they hide the fact that the class isn't defined. What if my > intention is to actually use that class object, but I fogot to include > the appropriate file before deserializing. That is an error in the > logic of my script, and I should be warned of such an error. Simple add a facility to Zend which allows registering a general function which is always called, when a user tries to execute a method of an object. This function could output a text like this: "The object foo was instantiated without having the class definition bar available. To use the methods of an object, you have to include the class definition." > Here is another idea, that would fit in with either of the other > proposals. A new function session_options(flag). This can take flags > that set various options. There would be a default behavoir defined via > ini file, as defined by one of the previous proposals, if the function > is not called. You could set options such as: WARN_UNDEFINED, > HALT_UNDEFINED, IGNORE_UNDEFINED. WARN_UNDEFINED will simply do a > E_NOTICE message, HALT_UNDEFINED would print E_ERROR message, > IGNORE_UNDEFINED will pass the undefined objects through. This way, for > development you can set the initial behavoir to HALT_UNDEFINED, and in > your script, when you know you dont need an objet, call > session_options(IGNORE_UNDEFINED). We now get the best of both worlds, > error messages when needed without changing the current session > functions. We might do that. - Sascha

« previous php.dev (#21975) next »