From bd4f32cf126b53345c5a4a8f8a9431fcb2144ed1 Mon Sep 17 00:00:00 2001 From: "Thies C. Arntzen" Date: Thu, 21 Jun 2001 18:46:26 +0000 Subject: - fixed the reference in session thingie - regression test checked (this time;-) - added new regression test for references - references _between_ session variables also work in when the session var replaces an already existing global var (this was a brain twister) - saved one strlen call per session variable - fixed one tiny leak --- ext/standard/php_var.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'ext/standard/php_var.h') diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h index ddaaf0fa12..7e2391adc3 100644 --- a/ext/standard/php_var.h +++ b/ext/standard/php_var.h @@ -43,6 +43,25 @@ int php_var_unserialize(pval **rval, const char **p, const char *max, php_serial #define PHP_VAR_UNSERIALIZE_DESTROY(var_hash) \ zend_hash_destroy(&(var_hash)) +#define PHP_VAR_UNSERIALIZE_ZVAL_CHANGED(var_hash,ozval,nzval) \ +if (var_hash) { \ + HashPosition pos; \ + zval **zval_ref; \ + zend_hash_internal_pointer_reset_ex(var_hash,&pos); \ + while (zend_hash_get_current_data_ex(var_hash, (void **) &zval_ref, &pos) == SUCCESS) { \ + if (*zval_ref == ozval) { \ + char *string_key; \ + ulong str_key_len; \ + ulong num_key; \ + zend_hash_get_current_key_ex(var_hash, &string_key, &str_key_len, &num_key, 1, &pos); \ + /* this is our hash and it _will_ be number indexed! */ \ + zend_hash_index_update(var_hash, num_key, &nzval, sizeof(zval *), NULL); \ + break; \ + } \ + zend_hash_move_forward_ex(var_hash,&pos); \ + } \ +} + PHPAPI zend_class_entry *php_create_empty_class(char *class_name,int len); #endif /* PHP_VAR_H */ -- cgit v1.2.1