diff options
| -rw-r--r-- | Zend/zend.c | 3 | ||||
| -rw-r--r-- | Zend/zend_builtin_functions.c | 6 | ||||
| -rw-r--r-- | Zend/zend_execute.c | 2 | ||||
| -rw-r--r-- | Zend/zend_hash.c | 9 | ||||
| -rw-r--r-- | Zend/zend_hash.h | 6 | 
5 files changed, 13 insertions, 13 deletions
diff --git a/Zend/zend.c b/Zend/zend.c index af2631ea5e..ad5c981547 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -94,10 +94,9 @@ static void print_hash(HashTable *ht, int indent)  			ZEND_PUTS(" ");  		}  		ZEND_PUTS("["); -		switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, &iterator)) { +		switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) {  			case HASH_KEY_IS_STRING:  				ZEND_PUTS(string_key); -				efree(string_key);  				break;  			case HASH_KEY_IS_LONG:  				zend_printf("%ld",num_key); diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index abb9d19a88..77c09c37d8 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -332,7 +332,7 @@ ZEND_FUNCTION(each)  	entry->refcount++;  	/* add the key elements */ -	switch (zend_hash_get_current_key(target_hash, &string_key, &num_key)) { +	switch (zend_hash_get_current_key(target_hash, &string_key, &num_key, 1)) {  		case HASH_KEY_IS_STRING:  			add_get_index_string(return_value,0,string_key,(void **) &inserted_pointer,0);  			break; @@ -589,7 +589,7 @@ ZEND_FUNCTION(get_class_methods)  		efree(lcname);  		array_init(return_value);  		zend_hash_internal_pointer_reset(&ce->function_table); -		while ((key_type = zend_hash_get_current_key(&ce->function_table, &string_key, &num_key)) != HASH_KEY_NON_EXISTANT) { +		while ((key_type = zend_hash_get_current_key(&ce->function_table, &string_key, &num_key, 1)) != HASH_KEY_NON_EXISTANT) {  			if (key_type == HASH_KEY_IS_STRING) {  				MAKE_STD_ZVAL(method_name);  				ZVAL_STRING(method_name, string_key, 0); @@ -731,7 +731,7 @@ ZEND_FUNCTION(get_included_files)  	array_init(return_value);  	zend_hash_internal_pointer_reset(&EG(included_files)); -	while(zend_hash_get_current_key(&EG(included_files), &entry,NULL) == HASH_KEY_IS_STRING) { +	while(zend_hash_get_current_key(&EG(included_files), &entry, NULL, 1) == HASH_KEY_IS_STRING) {  		add_next_index_string(return_value,entry,0);  		zend_hash_move_forward(&EG(included_files));  	} diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index a64ba0db7f..945c65684d 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2221,7 +2221,7 @@ send_by_ref:  					ALLOC_ZVAL(key);  					INIT_PZVAL(key); -					switch (zend_hash_get_current_key(fe_ht, &str_key, &int_key)) { +					switch (zend_hash_get_current_key(fe_ht, &str_key, &int_key, 1)) {  						case HASH_KEY_IS_STRING:  							key->value.str.val = str_key;  							key->value.str.len = strlen(str_key); diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index dc5b4d2a7a..16a9080cd1 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -1019,7 +1019,7 @@ ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos)  /* This function should be made binary safe  */ -ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong *str_length, ulong *num_index, HashPosition *pos) +ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos)  {  	Bucket *p; @@ -1029,9 +1029,10 @@ ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong  	if (p) {  		if (p->nKeyLength) { -			*str_index = (char *) estrndup(p->arKey, p->nKeyLength); -			if (ht->persistent) { -				persist_alloc(*str_index); +			if (duplicate) { +				*str_index = estrndup(p->arKey, p->nKeyLength); +			} else { +				*str_index = p->arKey;  			}  			if (str_length) {  				*str_length = p->nKeyLength; diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h index 85abe7ff61..2d2c6cd75a 100644 --- a/Zend/zend_hash.h +++ b/Zend/zend_hash.h @@ -146,7 +146,7 @@ ZEND_API ulong zend_hash_next_free_element(HashTable *ht);  /* traversing */  ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos);  ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos); -ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong *str_length, ulong *num_index, HashPosition *pos); +ZEND_API int zend_hash_get_current_key_ex(HashTable *ht, char **str_index, ulong *str_length, ulong *num_index, zend_bool duplicate, HashPosition *pos);  ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos);  ZEND_API int zend_hash_get_current_data_ex(HashTable *ht, void **pData, HashPosition *pos);  ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos); @@ -156,8 +156,8 @@ ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos  	zend_hash_move_forward_ex(ht, NULL)  #define zend_hash_move_backwards(ht) \  	zend_hash_move_backwards_ex(ht, NULL) -#define zend_hash_get_current_key(ht, str_index, num_index) \ -	zend_hash_get_current_key_ex(ht, str_index, NULL, num_index, NULL) +#define zend_hash_get_current_key(ht, str_index, num_index, duplicate) \ +	zend_hash_get_current_key_ex(ht, str_index, NULL, num_index, duplicate, NULL)  #define zend_hash_get_current_key_type(ht) \  	zend_hash_get_current_key_type_ex(ht, NULL)  #define zend_hash_get_current_data(ht, pData) \  | 
