diff options
| author | Xinchen Hui <laruence@php.net> | 2014-05-07 17:06:27 +0800 | 
|---|---|---|
| committer | Xinchen Hui <laruence@php.net> | 2014-05-07 17:06:27 +0800 | 
| commit | 2393000aeb6be8f7dd9e33585b96bb279f4f1eff (patch) | |
| tree | 784ba337ad660c887ba38218e9e1c67a15201de4 /main/php_variables.c | |
| parent | e3a08096553df89b1c73eafdd9fd1ca2288cdce0 (diff) | |
| download | php-git-2393000aeb6be8f7dd9e33585b96bb279f4f1eff.tar.gz | |
Prefer the macro we defined
Diffstat (limited to 'main/php_variables.c')
| -rw-r--r-- | main/php_variables.c | 18 | 
1 files changed, 7 insertions, 11 deletions
| diff --git a/main/php_variables.c b/main/php_variables.c index c67642c76f..30a84822af 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -625,22 +625,19 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC)  	zval *src_entry, *dest_entry;  	zend_string *string_key;  	ulong num_key; -	HashPosition pos; -	int key_type;  	int globals_check = (dest == (&EG(symbol_table).ht)); -	zend_hash_internal_pointer_reset_ex(src, &pos); -	while ((src_entry = zend_hash_get_current_data_ex(src, &pos)) != NULL) { -		key_type = zend_hash_get_current_key_ex(src, &string_key, &num_key, 0, &pos); +	ZEND_HASH_FOREACH_KEY_VAL(src, num_key, string_key, src_entry) {  		if (Z_TYPE_P(src_entry) != IS_ARRAY -			|| (key_type == HASH_KEY_IS_STRING && (dest_entry = zend_hash_find(dest, string_key)) == NULL) -			|| (key_type == HASH_KEY_IS_LONG && (dest_entry = zend_hash_index_find(dest, num_key)) == NULL) +			|| (string_key && (dest_entry = zend_hash_find(dest, string_key)) == NULL) +			|| (string_key == NULL && (dest_entry = zend_hash_index_find(dest, num_key)) == NULL)  			|| Z_TYPE_P(dest_entry) != IS_ARRAY) {  			if (Z_REFCOUNTED_P(src_entry)) {  				Z_ADDREF_P(src_entry);  			} -			if (key_type == HASH_KEY_IS_STRING) { -				if (!globals_check || string_key->len != sizeof("GLOBALS") || memcmp(string_key->val, "GLOBALS", sizeof("GLOBALS") - 1)) { +			if (string_key) { +				if (!globals_check || string_key->len != sizeof("GLOBALS") - 1  +						|| memcmp(string_key->val, "GLOBALS", sizeof("GLOBALS") - 1)) {  					zend_hash_update(dest, string_key, src_entry);  				} else if (Z_REFCOUNTED_P(src_entry)) {  					Z_DELREF_P(src_entry); @@ -652,8 +649,7 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC)  			SEPARATE_ZVAL(dest_entry);  			php_autoglobal_merge(Z_ARRVAL_P(dest_entry), Z_ARRVAL_P(src_entry) TSRMLS_CC);  		} -		zend_hash_move_forward_ex(src, &pos); -	} +	} ZEND_HASH_FOREACH_END();  }  /* }}} */ | 
