cvs: php4 /ext/session/ session.c /ext/wddx/ php_wddx_api.h wddx.c

From: Date: Fri, 09 Jun 2000 03:00:02 +0000
Subject: cvs: php4 /ext/session/ session.c /ext/wddx/ php_wddx_api.h wddx.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-103@lists.php.net to get a copy of this message
andrei Thu Jun 8 20:00:02 2000 EDT Modified files: /php4/ext/session session.c /php4/ext/wddx php_wddx_api.h wddx.c Log: (php_wddx_deserialize_ex) return SUCCESS/FAILURE Use that return value in WDDX session deserializer. Index: php4/ext/session/session.c diff -u php4/ext/session/session.c:1.146 php4/ext/session/session.c:1.147 --- php4/ext/session/session.c:1.146 Thu Jun 8 17:26:56 2000 +++ php4/ext/session/session.c Thu Jun 8 20:00:01 2000 @@ -336,42 +336,35 @@ ulong idx; int hash_type; int dofree = 1; - int ret = SUCCESS; + int ret; if (vallen == 0) return SUCCESS; MAKE_STD_ZVAL(retval); - retval->type = IS_NULL; + if ((ret = php_wddx_deserialize_ex((char *)val, vallen, retval)) == SUCCESS) { - php_wddx_deserialize_ex((char *)val, vallen, retval); - - if (retval->type == IS_NULL) { - ret = FAILURE; - goto cleanup; - } - - for (zend_hash_internal_pointer_reset(retval->value.ht); - zend_hash_get_current_data(retval->value.ht, (void **) &ent) == SUCCESS; - zend_hash_move_forward(retval->value.ht)) { - hash_type = zend_hash_get_current_key(retval->value.ht, &key, &idx); - - switch (hash_type) { - case HASH_KEY_IS_LONG: - sprintf(tmp, "%ld", idx); - key = tmp; - dofree = 0; - /* fallthru */ - case HASH_KEY_IS_STRING: - php_set_session_var(key, strlen(key), *ent PSLS_CC); - PS_ADD_VAR(key); - if (dofree) efree(key); - dofree = 1; + for (zend_hash_internal_pointer_reset(retval->value.ht); + zend_hash_get_current_data(retval->value.ht, (void **) &ent) == SUCCESS; + zend_hash_move_forward(retval->value.ht)) { + hash_type = zend_hash_get_current_key(retval->value.ht, &key, &idx); + + switch (hash_type) { + case HASH_KEY_IS_LONG: + sprintf(tmp, "%ld", idx); + key = tmp; + dofree = 0; + /* fallthru */ + case HASH_KEY_IS_STRING: + php_set_session_var(key, strlen(key), *ent PSLS_CC); + PS_ADD_VAR(key); + if (dofree) efree(key); + dofree = 1; + } } } -cleanup: zval_dtor(retval); efree(retval); Index: php4/ext/wddx/php_wddx_api.h diff -u php4/ext/wddx/php_wddx_api.h:1.8 php4/ext/wddx/php_wddx_api.h:1.9 --- php4/ext/wddx/php_wddx_api.h:1.8 Thu May 18 08:34:38 2000 +++ php4/ext/wddx/php_wddx_api.h Thu Jun 8 20:00:02 2000 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_wddx_api.h,v 1.8 2000/05/18 15:34:38 zeev Exp $ */ +/* $Id: php_wddx_api.h,v 1.9 2000/06/09 03:00:02 andrei Exp $ */ #ifndef PHP_WDDX_API_H #define PHP_WDDX_API_H @@ -60,7 +60,7 @@ void php_wddx_serialize_var(wddx_packet *packet, zval *var, char *name); void php_wddx_add_chunk_ex(wddx_packet *packet, char *str, int length); -void php_wddx_deserialize_ex(char *, int, zval *return_value); +int php_wddx_deserialize_ex(char *, int, zval *return_value); char *php_wddx_gather(wddx_packet *packet); #endif /* PHP_WDDX_API_H */ Index: php4/ext/wddx/wddx.c diff -u php4/ext/wddx/wddx.c:1.35 php4/ext/wddx/wddx.c:1.36 --- php4/ext/wddx/wddx.c:1.35 Mon Jun 5 12:47:45 2000 +++ php4/ext/wddx/wddx.c Thu Jun 8 20:00:02 2000 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: wddx.c,v 1.35 2000/06/05 19:47:45 andi Exp $ */ +/* $Id: wddx.c,v 1.36 2000/06/09 03:00:02 andrei Exp $ */ #include "php.h" #include "php_wddx.h" @@ -744,12 +744,13 @@ /* }}} */ -/* {{{ void php_wddx_deserialize_ex(char *value, int vallen, zval *return_value) */ -void php_wddx_deserialize_ex(char *value, int vallen, zval *return_value) +/* {{{ int php_wddx_deserialize_ex(char *value, int vallen, zval *return_value) */ +int php_wddx_deserialize_ex(char *value, int vallen, zval *return_value) { wddx_stack stack; XML_Parser parser; st_entry *ent; + int retval; wddx_stack_init(&stack); parser = XML_ParserCreate("ISO-8859-1"); @@ -766,9 +767,13 @@ wddx_stack_top(&stack, (void**)&ent); *return_value = *(ent->data); zval_copy_ctor(return_value); - } + retval = SUCCESS; + } else + retval = FAILURE; wddx_stack_destroy(&stack); + + return retval; } /* }}} */

« previous php.cvs (#103) next »