Re: Can you serialize a Formbuilder object?
| From: | Alexey Borzov | Date: | Tue, 28 Jun 2005 07:08:04 +0000 |
| Subject: | Re: Can you serialize a Formbuilder object? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19794@lists.php.net to get a copy of this message | ||
Hi,
Andrew Wooldridge wrote:
But I did not call 'require_once' with the others, including all possible quickform elements are still __PHP_Incomplete_Class typed inside the formbuilder object : DB/DataObject/FormBuilder/QuickForm.php HTML/QuickForm/header.php HTML/QuickForm/hidden.php HTML/QuickForm/text.php Etc.... I require_once'd the /FormBuilder/QuickForm.php and that fixed Incomplete type error. Might there be a way to avoid requiring every single class used by quickform?There is a way to automate [1] this requiring business: ========== unserialize_callback_func directive: It's possible to set a callback-function which will be called, if an undefined class should be instantiated during unserializing. (to prevent getting an incomplete object "__PHP_Incomplete_Class".) Use your php.ini, ini_set() or .htaccess to define 'unserialize_callback_func'. Everytime an undefined class should be instantiated, it'll be called. To disable this feature just empty this setting. Also note that the directive unserialize_callback_func directive became available in PHP 4.2.0. ========== Though I don't see the point in serializing a QuickForm object, since it is not designed to update its state on unserializing. [1] http://ru.php.net/unserialize