RE: [PHP-CVS] cvs: php4 /ext/session session.c

From: Date: Sun, 19 Nov 2000 18:49:57 +0000
Subject: RE: [PHP-CVS] cvs: php4 /ext/session session.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-2690@lists.php.net to get a copy of this message
At 19:09 18/11/00 +0100, Sterling Hughes wrote:
+                     is_ref = (*old_symbol)->is_ref;
+                     refcount = (*old_symbol)->refcount;
+                     **old_symbol = *state_val_copy;
+                     (*old_symbol)->is_ref = is_ref;
+                     (*old_symbol)->refcount = refcount;
SS>>     I think this kind of logic should be in Zend, and not in the
SS>>     extension code. While the task of changing an existing symbol
SS>>     might be complex, it should be simple for an extension to
SS>>     perform that step.
You might be right, though Zend does not have such an opearion in it's API presently. So if somebody (Zeev, Andi?) can generalize this and add such an op to Zend, it would be good. Generally, what I need is to replace variable contents while preserving it's refcount and is_ref. I don't have a compilation enviroment handy, but: ZEND_API void zval_swap_contents(zval *var1, zval *var2) {
        int is_ref,
          refcount;
        zval_dtor(var1);
        is_ref = var1->is_ref;
        refcount = var1->refcount;
        *var1 = *var2;
        var1->is_ref = is_ref;
        var2->refcount = refcount;
} Should do the trick, shouldn't it (famous last words;)?
Not quite, and it probably should be a macro. We'll try and work out something nice and useable. Andi
BTW: we are going into Zend guts more or less anyway in serializing variables, it's inevitable. But I agree this code is ugly - it has to do ugly thing, so it is. Perhaps then Zend should have a set of serialization functions (or an intermediate structure where the contents of a variable can be stored), enough of the extensions rely on this feature. -Sterling -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-cvs-unsubscribe@lists.php.net For additional commands, e-mail: php-cvs-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
--- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.cvs (#2690) next »