Re: Serializing references - part I
| From: | Stanislav Malyshev | Date: | Tue, 24 Oct 2000 09:54:52 +0000 |
| Subject: | Re: Serializing references - part I | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-36005@lists.php.net to get a copy of this message | ||
SS>> HashTable var_hash;
SS>>
SS>> zend_hash_init(..);
SS>> php_var_(un)serialize(..);
SS>> zend_hash_destroy(..);
SS>>
SS>> we would use
SS>>
SS>> php_var_hash_t var_hash;
SS>>
SS>> var_hash = var_hash_init();
SS>> php_var_(un)serialize(..);
SS>> var_hash_destroy(var_hash);
In fact, I do not see any difference. All the custom (for different
serializers) code will go after hash init anyway. But I can make it, if
you like, I only see no point in it.
SS>> Any idea why this drops the property n?
SS>>
SS>> class foo {
SS>> var $ok = "yes";
SS>> }
SS>>
SS>> $c = new foo;
SS>> $c->n = &$c;
SS>>
SS>> print serialize(&$c)."\n";
Why call-time reference? I'm even not sure what it does, but you should
not use it.
SS>> O:3:"foo":2:{s:2:"ok";s:3:"yes";}
This is wrong result, for me it gives:
O:3:"foo":2:{s:2:"ok";s:3:"yes";s:1:"n";O:3:"foo":2:{s:2:"ok";R:2;}}
Which, btw, is wrong too - should be R:1. More work is needed on ot.
--
Stanislav Malyshev, Zend Products Engineer
stas@zend.com http://www.zend.com/ +972-3-6139665 ext.106