Re: Serializing references - part I
| From: | Sascha Schumann | Date: | Tue, 24 Oct 2000 10:27:43 +0000 |
| Subject: | Re: Serializing references - part I | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-36086@lists.php.net to get a copy of this message | ||
On Tue, 24 Oct 2000, Stanislav Malyshev wrote:
> SS>> $c = new foo;
> SS>> $c->n = &$c;
> SS>>
> SS>> print serialize(&$c)."\n";
> SS>> print $c->n->ok."\n";
>
> Ough. I see now: var_serialize has a clause specifically prohibiting
> serializing circular reference:
>
> if(zend_hash_get_current_data_ex(myht, (void **) (&data), &pos) != SUCCESS
> || !data || ((*data) == (*struc))) {
> if (i == HASH_KEY_IS_STRING)
> efree(key);
> continue;
> }
Yuck, pretty ineffective.
In the example I posted, using a[0] instead of n circumvents
the above check.
- Sascha