zeev Tue Jul 22 12:08:50 2003 EDT Modified files: /php-src/ext/standard array.c /php-src/main php_variables.c Log: - Use the new infrastructure of zend_symtable_*() (fixes bug #24565) - Fix bogus use of get_current_key() Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.234 php-src/ext/standard/array.c:1.235 --- php-src/ext/standard/array.c:1.234 Mon Jun 16 13:35:16 2003 +++ php-src/ext/standard/array.c Tue Jul 22 12:08:49 2003 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.234 2003/06/16 17:35:16 iliaa Exp $ */ +/* $Id: array.c,v 1.235 2003/07/22 16:08:49 zeev Exp $ */ #include "php.h" #include "php_ini.h" @@ -3643,11 +3643,7 @@ switch (Z_TYPE_PP(key)) { case IS_STRING: - if (zend_is_numeric_key(*key, &lvalue)) { - if (zend_hash_index_exists(HASH_OF(*array), lvalue)) { - RETURN_TRUE; - } - } else if (zend_hash_exists(HASH_OF(*array), Z_STRVAL_PP(key), Z_STRLEN_PP(key)+1)) { + if (zend_symtable_exists(HASH_OF(*array), Z_STRVAL_PP(key), Z_STRLEN_PP(key)+1)) { RETURN_TRUE; } RETURN_FALSE; Index: php-src/main/php_variables.c diff -u php-src/main/php_variables.c:1.65 php-src/main/php_variables.c:1.66 --- php-src/main/php_variables.c:1.65 Mon Jul 21 13:42:24 2003 +++ php-src/main/php_variables.c Tue Jul 22 12:08:50 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_variables.c,v 1.65 2003/07/21 17:42:24 zeev Exp $ */ +/* $Id: php_variables.c,v 1.66 2003/07/22 16:08:50 zeev Exp $ */ #include <stdio.h> #include "php.h" @@ -152,11 +152,11 @@ } else { escaped_index = index; } - if (zend_hash_find(symtable1, escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE + if (zend_symtable_find(symtable1, escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) { MAKE_STD_ZVAL(gpc_element); array_init(gpc_element); - zend_hash_update(symtable1, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); + zend_symtable_update(symtable1, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); } if (index!=escaped_index) { efree(escaped_index); @@ -182,7 +182,7 @@ if (!index) { zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); } else { - zend_hash_update(symtable1, index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); + zend_symtable_update(symtable1, index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); } break; } @@ -498,20 +498,20 @@ */ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) { - zval **src_entry, **dest_entry; - char *string_key; - uint string_key_len; - ulong num_key; - HashPosition pos; - int key_type; + zval **src_entry, **dest_entry; + char *string_key; + uint string_key_len; + ulong num_key; + HashPosition pos; + int key_type; zend_hash_internal_pointer_reset_ex(src, &pos); while (zend_hash_get_current_data_ex(src, (void **)&src_entry, &pos) == SUCCESS) { key_type = zend_hash_get_current_key_ex(src, &string_key, &string_key_len, &num_key, 0, &pos); - if (Z_TYPE_PP(src_entry) != IS_ARRAY || - (string_key_len && zend_hash_find(dest, string_key, string_key_len, (void **)&dest_entry) != SUCCESS) || - (!string_key_len && zend_hash_index_find(dest, num_key, (void **)&dest_entry) != SUCCESS) - || Z_TYPE_PP(dest_entry) != IS_ARRAY) { + if (Z_TYPE_PP(src_entry) != IS_ARRAY + || (key_type==HASH_KEY_IS_STRING && zend_hash_find(dest, string_key, string_key_len, (void **) &dest_entry) != SUCCESS) + || (key_type==HASH_KEY_IS_LONG && zend_hash_index_find(dest, num_key, (void **)&dest_entry) != SUCCESS) + || Z_TYPE_PP(dest_entry) != IS_ARRAY) { (*src_entry)->refcount++; if (key_type == HASH_KEY_IS_STRING) { zend_hash_update(dest, string_key, strlen(string_key)+1, src_entry, sizeof(zval *), NULL);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php