]> granicus.if.org Git - php/commitdiff
Refactored zend_hash_* iteration API zend_hash_fove_forward_ex(ht, pos) and family...
authorDmitry Stogov <dmitry@zend.com>
Mon, 7 Apr 2014 19:14:17 +0000 (23:14 +0400)
committerDmitry Stogov <dmitry@zend.com>
Mon, 7 Apr 2014 19:14:17 +0000 (23:14 +0400)
&(ht)->nInternalPointer should be passed instead of NULL.
zend_hash_update_current_key() may work only with internal pointer.

15 files changed:
Zend/zend_builtin_functions.c
Zend/zend_execute_API.c
Zend/zend_hash.c
Zend/zend_hash.h
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
ext/pcre/php_pcre.c
ext/session/php_session.h
ext/standard/array.c
ext/standard/http.c
ext/standard/info.c
ext/standard/streamsfuncs.c
ext/standard/string.c
ext/standard/user_filters.c
main/php_ini.c

index b6dd50ddf473b1f3c3167c56f08793ace9eec7d0..b453676d635f124c1cbad1ebbf7118ee550a121c 100644 (file)
@@ -618,7 +618,7 @@ ZEND_FUNCTION(each)
        if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry);
 
        /* add the key elements */
-       switch (zend_hash_get_current_key_ex(target_hash, &key, &num_key, 0, NULL)) {
+       switch (zend_hash_get_current_key(target_hash, &key, &num_key, 0)) {
                case HASH_KEY_IS_STRING:
                        inserted_pointer = add_get_index_str(return_value, 0, STR_COPY(key));
                        break;
@@ -1446,7 +1446,7 @@ ZEND_FUNCTION(get_included_files)
 
        array_init(return_value);
        zend_hash_internal_pointer_reset(&EG(included_files));
-       while (zend_hash_get_current_key_ex(&EG(included_files), &entry, NULL, 0, NULL) == HASH_KEY_IS_STRING) {
+       while (zend_hash_get_current_key(&EG(included_files), &entry, NULL, 0) == HASH_KEY_IS_STRING) {
                add_next_index_str(return_value, STR_COPY(entry));
                zend_hash_move_forward(&EG(included_files));
        }
index a56b32a6f424f15be680e20657c74ed149f28ca5..018e473995a734a0fe387119fdccde8671d8dec5 100644 (file)
@@ -601,7 +601,7 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope
                /* First go over the array and see if there are any constant indices */
                zend_hash_internal_pointer_reset(Z_ARRVAL_P(p));
                while ((element = zend_hash_get_current_data(Z_ARRVAL_P(p))) != NULL) {
-                       if (zend_hash_get_current_key_ex(Z_ARRVAL_P(p), &str_index, &num_index, 0, NULL) != HASH_KEY_IS_STRING) {
+                       if (zend_hash_get_current_key(Z_ARRVAL_P(p), &str_index, &num_index, 0) != HASH_KEY_IS_STRING) {
                                zend_hash_move_forward(Z_ARRVAL_P(p));
                                continue;
                        }
@@ -666,17 +666,17 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope
 
                        switch (Z_TYPE(const_value)) {
                                case IS_STRING:
-                                       ret = zend_symtable_update_current_key(Z_ARRVAL_P(p), Z_STR(const_value), HASH_UPDATE_KEY_IF_BEFORE);
+                                       ret = zend_symtable_update_current_key_ex(Z_ARRVAL_P(p), Z_STR(const_value), HASH_UPDATE_KEY_IF_BEFORE);
                                        break;
                                case IS_BOOL:
                                case IS_LONG:
-                                       ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, Z_LVAL(const_value), HASH_UPDATE_KEY_IF_BEFORE, NULL);
+                                       ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, Z_LVAL(const_value), HASH_UPDATE_KEY_IF_BEFORE);
                                        break;
                                case IS_DOUBLE:
-                                       ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, zend_dval_to_lval(Z_DVAL(const_value)), HASH_UPDATE_KEY_IF_BEFORE, NULL);
+                                       ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, zend_dval_to_lval(Z_DVAL(const_value)), HASH_UPDATE_KEY_IF_BEFORE);
                                        break;
                                case IS_NULL:
-                                       ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, STR_EMPTY_ALLOC(), 0, HASH_UPDATE_KEY_IF_BEFORE, NULL);
+                                       ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, STR_EMPTY_ALLOC(), 0, HASH_UPDATE_KEY_IF_BEFORE);
                                        break;
                                default:
                                        ret = SUCCESS;
index 88bd2afccd5b5543d12a9ce488057edc11d382bb..41e0bfcb024186acd7e5ee1e2bbeb8d7fe0bcacf 100644 (file)
@@ -1306,22 +1306,13 @@ ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *p
     uint idx;
        
        IS_CONSISTENT(ht);
-
        for (idx = 0; idx < ht->nNumUsed; idx++) {
                if (Z_TYPE(ht->arData[idx].val) != IS_UNDEF) {
-                       if (pos) {
-                               *pos = idx;
-                       } else {
-                               ht->nInternalPointer = idx;
-                       }
+                       *pos = idx;
                        return;
                }
        }
-       if (pos) {
-               *pos = INVALID_IDX;
-       } else {
-               ht->nInternalPointer = INVALID_IDX;
-       }
+       *pos = INVALID_IDX;
 }
 
 
@@ -1338,26 +1329,17 @@ ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos
        while (idx > 0) {
                idx--;
                if (Z_TYPE(ht->arData[idx].val) != IS_UNDEF) {
-                       if (pos) {
-                               *pos = idx;
-                       } else {
-                               ht->nInternalPointer = idx;
-                       }
+                       *pos = idx;
                        return;
                }
        }
-       if (pos) {
-               *pos = INVALID_IDX;
-       } else {
-               ht->nInternalPointer = INVALID_IDX;
-       }
+       *pos = INVALID_IDX;
 }
 
 
 ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos)
 {
-       HashPosition *current = pos ? pos : &ht->nInternalPointer;
-       uint idx = *current;
+       uint idx = *pos;
 
        IS_CONSISTENT(ht);
 
@@ -1365,11 +1347,11 @@ ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos)
                while (1) {
                        idx++;
                        if (idx >= ht->nNumUsed) {
-                               *current = INVALID_IDX;
+                               *pos = INVALID_IDX;
                                return SUCCESS;
                        }
                        if (Z_TYPE(ht->arData[idx].val) != IS_UNDEF) {
-                               *current = idx;
+                               *pos = idx;
                                return SUCCESS;
                        }
                }
@@ -1380,8 +1362,7 @@ ZEND_API int zend_hash_move_forward_ex(HashTable *ht, HashPosition *pos)
 
 ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos)
 {
-       HashPosition *current = pos ? pos : &ht->nInternalPointer;
-       uint idx = *current;
+       uint idx = *pos;
 
        IS_CONSISTENT(ht);
 
@@ -1389,11 +1370,11 @@ ZEND_API int zend_hash_move_backwards_ex(HashTable *ht, HashPosition *pos)
                while (idx > 0) {
                        idx--;
                        if (Z_TYPE(ht->arData[idx].val) != IS_UNDEF) {
-                               *current = idx;
+                               *pos = idx;
                                return SUCCESS;
                        }
                }
-               *current = INVALID_IDX;
+               *pos = INVALID_IDX;
                return SUCCESS;
        } else {
                return FAILURE;
@@ -1404,13 +1385,10 @@ 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(const HashTable *ht, zend_string **str_index, ulong *num_index, zend_bool duplicate, HashPosition *pos)
 {
-       uint idx;
+       uint idx = *pos;
        Bucket *p;
 
-       idx = pos ? (*pos) : ht->nInternalPointer;
-
        IS_CONSISTENT(ht);
-
        if (idx != INVALID_IDX) {
                p = ht->arData + idx;
                if (p->key) {
@@ -1430,13 +1408,10 @@ ZEND_API int zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str
 
 ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos)
 {
-       uint idx;
+       uint idx = *pos;
        Bucket *p;
 
        IS_CONSISTENT(ht);
-
-       idx = pos ? (*pos) : ht->nInternalPointer;
-
        if (idx == INVALID_IDX) {
                ZVAL_NULL(key);
        } else {
@@ -1452,13 +1427,10 @@ ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key,
 
 ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos)
 {
-    uint idx;
+    uint idx = *pos;
        Bucket *p;
 
-       idx = pos ? (*pos) : ht->nInternalPointer;
-
        IS_CONSISTENT(ht);
-
        if (idx != INVALID_IDX) {
                p = ht->arData + idx;
                if (p->key) {
@@ -1473,13 +1445,10 @@ ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos)
 
 ZEND_API zval *zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos)
 {
-       uint idx;
+       uint idx = *pos;
        Bucket *p;
 
-       idx = pos ? (*pos) : ht->nInternalPointer;
-
        IS_CONSISTENT(ht);
-
        if (idx != INVALID_IDX) {
                p = ht->arData + idx;
                return &p->val;
@@ -1491,19 +1460,17 @@ ZEND_API zval *zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos)
 /* This function changes key of current element without changing elements'
  * order. If element with target key already exists, it will be deleted first.
  */
-ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zend_string *str_index, ulong num_index, int mode, HashPosition *pos)
+ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zend_string *str_index, ulong num_index, int mode)
 {
-       uint idx1, idx2;
+       uint idx1 = ht->nInternalPointer;
+       uint idx2;
        Bucket *p, *q;
        ulong h;
 #ifdef ZEND_SIGNALS
        TSRMLS_FETCH();
 #endif
 
-       idx1 = pos ? (*pos) : ht->nInternalPointer;
-
        IS_CONSISTENT(ht);
-
        if (idx1 != INVALID_IDX) {
                p = ht->arData + idx1;
                if (key_type == HASH_KEY_IS_LONG) {
index ee31071cd9ecabd87d61058ea2d852c51887a852..11dc92d3c3ccc4efac2d169a836a4cb23559ee10 100644 (file)
@@ -151,7 +151,7 @@ ZEND_API int zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos)
 ZEND_API zval *zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos);
 ZEND_API void zend_hash_internal_pointer_reset_ex(HashTable *ht, HashPosition *pos);
 ZEND_API void zend_hash_internal_pointer_end_ex(HashTable *ht, HashPosition *pos);
-ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zend_string *str_index, ulong num_index, int mode, HashPosition *pos);
+ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zend_string *str_index, ulong num_index, int mode);
 
 typedef struct _HashPointer {
        HashPosition pos;
@@ -163,25 +163,25 @@ ZEND_API int zend_hash_get_pointer(const HashTable *ht, HashPointer *ptr);
 ZEND_API int zend_hash_set_pointer(HashTable *ht, const HashPointer *ptr);
 
 #define zend_hash_has_more_elements(ht) \
-       zend_hash_has_more_elements_ex(ht, NULL)
+       zend_hash_has_more_elements_ex(ht, &(ht)->nInternalPointer)
 #define zend_hash_move_forward(ht) \
-       zend_hash_move_forward_ex(ht, NULL)
+       zend_hash_move_forward_ex(ht, &(ht)->nInternalPointer)
 #define zend_hash_move_backwards(ht) \
-       zend_hash_move_backwards_ex(ht, NULL)
+       zend_hash_move_backwards_ex(ht, &(ht)->nInternalPointer)
 #define zend_hash_get_current_key(ht, str_index, num_index, duplicate) \
-       zend_hash_get_current_key_ex(ht, str_index, num_index, duplicate, NULL)
+       zend_hash_get_current_key_ex(ht, str_index, num_index, duplicate, &(ht)->nInternalPointer)
 #define zend_hash_get_current_key_zval(ht, key) \
-       zend_hash_get_current_key_zval_ex(ht, key, NULL)
+       zend_hash_get_current_key_zval_ex(ht, key, &(ht)->nInternalPointer)
 #define zend_hash_get_current_key_type(ht) \
-       zend_hash_get_current_key_type_ex(ht, NULL)
+       zend_hash_get_current_key_type_ex(ht, &(ht)->nInternalPointer)
 #define zend_hash_get_current_data(ht) \
-       zend_hash_get_current_data_ex(ht, NULL)
+       zend_hash_get_current_data_ex(ht, &(ht)->nInternalPointer)
 #define zend_hash_internal_pointer_reset(ht) \
-       zend_hash_internal_pointer_reset_ex(ht, NULL)
+       zend_hash_internal_pointer_reset_ex(ht, &(ht)->nInternalPointer)
 #define zend_hash_internal_pointer_end(ht) \
-       zend_hash_internal_pointer_end_ex(ht, NULL)
+       zend_hash_internal_pointer_end_ex(ht, &(ht)->nInternalPointer)
 #define zend_hash_update_current_key(ht, key_type, str_index, str_length, num_index) \
-       zend_hash_update_current_key_ex(ht, key_type, str_index, str_length, num_index, HASH_UPDATE_KEY_ANYWAY, NULL)
+       zend_hash_update_current_key_ex(ht, key_type, str_index, str_length, num_index, HASH_UPDATE_KEY_ANYWAY)
 
 /* Copying, merging and sorting */
 ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor);
@@ -372,13 +372,11 @@ static inline int zend_symtable_str_exists(HashTable *ht, const char *str, int l
        return zend_hash_str_exists(ht, str, len);
 }
 
-static inline int zend_symtable_update_current_key_ex(HashTable *ht, zend_string *key, int mode, HashPosition *pos)
+static inline int zend_symtable_update_current_key_ex(HashTable *ht, zend_string *key, int mode)
 {
-ZEND_HANDLE_NUMERIC(key->val, key->len+1, zend_hash_update_current_key_ex(ht, HASH_KEY_IS_LONG, NULL, idx, mode, pos));
-       return zend_hash_update_current_key_ex(ht, HASH_KEY_IS_STRING, key, 0, mode, pos);
+ZEND_HANDLE_NUMERIC(key->val, key->len+1, zend_hash_update_current_key_ex(ht, HASH_KEY_IS_LONG, NULL, idx, mode));
+       return zend_hash_update_current_key_ex(ht, HASH_KEY_IS_STRING, key, 0, mode);
 }
-#define zend_symtable_update_current_key(ht, key, mode) \
-       zend_symtable_update_current_key_ex(ht, key, mode, NULL)
 
 static inline void *zend_hash_add_ptr(HashTable *ht, zend_string *key, void *pData)
 {
@@ -533,7 +531,7 @@ static inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht, HashPositio
 }
 
 #define zend_hash_get_current_data_ptr(ht) \
-       zend_hash_get_current_data_ptr_ex(ht, NULL)
+       zend_hash_get_current_data_ptr_ex(ht, &(ht)->nInternalPointer)
 
 #endif                                                 /* ZEND_HASH_H */
 
index 16e8d7a6b238329fcae10657760cce93d0113442..f028d2cb66de64fdcd63b72ac0b8d4f5205d8fc7 100644 (file)
@@ -4266,7 +4266,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
                                ulong int_key;
                                zend_uchar key_type;
 
-                               key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &int_key, 0, NULL);
+                               key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
                                if (key_type != HASH_KEY_NON_EXISTENT &&
                                        (key_type == HASH_KEY_IS_LONG ||
                                     zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
@@ -4339,7 +4339,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
                                        }
                                }
 
-                               key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &int_key, 0, NULL);
+                               key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
 
                                zend_hash_move_forward(fe_ht);
                                if (key_type == HASH_KEY_IS_LONG ||
index 80bbe89bfb815fa01fd85672d6084561af65cd52..cd918808038e48880d3e095d9bf686f33bf36c1b 100644 (file)
@@ -3092,7 +3092,7 @@ static int ZEND_FASTCALL  ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
                                ulong int_key;
                                zend_uchar key_type;
 
-                               key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &int_key, 0, NULL);
+                               key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
                                if (key_type != HASH_KEY_NON_EXISTENT &&
                                        (key_type == HASH_KEY_IS_LONG ||
                                     zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
@@ -8148,7 +8148,7 @@ static int ZEND_FASTCALL  ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
                                ulong int_key;
                                zend_uchar key_type;
 
-                               key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &int_key, 0, NULL);
+                               key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
                                if (key_type != HASH_KEY_NON_EXISTENT &&
                                        (key_type == HASH_KEY_IS_LONG ||
                                     zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
@@ -13246,7 +13246,7 @@ static int ZEND_FASTCALL  ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
                                ulong int_key;
                                zend_uchar key_type;
 
-                               key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &int_key, 0, NULL);
+                               key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
                                if (key_type != HASH_KEY_NON_EXISTENT &&
                                        (key_type == HASH_KEY_IS_LONG ||
                                     zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
@@ -13319,7 +13319,7 @@ static int ZEND_FASTCALL  ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
                                        }
                                }
 
-                               key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &int_key, 0, NULL);
+                               key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
 
                                zend_hash_move_forward(fe_ht);
                                if (key_type == HASH_KEY_IS_LONG ||
@@ -29701,7 +29701,7 @@ static int ZEND_FASTCALL  ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
                                ulong int_key;
                                zend_uchar key_type;
 
-                               key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &int_key, 0, NULL);
+                               key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
                                if (key_type != HASH_KEY_NON_EXISTENT &&
                                        (key_type == HASH_KEY_IS_LONG ||
                                     zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
index eb77a39cb342a57bcc85e716454a50be5b50d744..2c228f0230881c3c50f09f34d6a74926d6c8d346 100644 (file)
@@ -1375,7 +1375,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
                        if ((result = php_replace_in_subject(regex, replace, subject_entry, limit_val, is_callable_replace, &replace_count TSRMLS_CC)) != NULL) {
                                if (!is_filter || replace_count > old_replace_count) {
                                        /* Add to return array */
-                                       switch(zend_hash_get_current_key_ex(Z_ARRVAL_P(subject), &string_key, &num_key, 0, NULL))
+                                       switch(zend_hash_get_current_key(Z_ARRVAL_P(subject), &string_key, &num_key, 0))
                                        {
                                        case HASH_KEY_IS_STRING:
                                                add_assoc_str_ex(return_value, string_key->val, string_key->len, result);
@@ -1824,7 +1824,7 @@ PHPAPI void  php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
                        }
 
                        /* Add to return array */
-                       switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(input), &string_key, &num_key, 0, NULL))
+                       switch (zend_hash_get_current_key(Z_ARRVAL_P(input), &string_key, &num_key, 0))
                        {
                                case HASH_KEY_IS_STRING:
                                        zend_hash_update(Z_ARRVAL_P(return_value), string_key, entry);
index 0153fe97e8bf27346f777f1d3b22640ab667157f..608d6bfdc2851cdfc4ac6b0331e2664c66109e2b 100644 (file)
@@ -262,8 +262,8 @@ PHPAPI void php_session_reset_id(TSRMLS_D);
                int key_type;                                                                                                   \
                                                                                                                                                \
                for (zend_hash_internal_pointer_reset(_ht);                                             \
-                               (key_type = zend_hash_get_current_key_ex(_ht, &key,             \
-                                               &num_key, 0, NULL)) != HASH_KEY_NON_EXISTENT;   \
+                               (key_type = zend_hash_get_current_key(_ht, &key,                \
+                                               &num_key, 0)) != HASH_KEY_NON_EXISTENT;         \
                                        zend_hash_move_forward(_ht)) {                                          \
                        if (key_type == HASH_KEY_IS_LONG) {                                                     \
                                php_error_docref(NULL TSRMLS_CC, E_NOTICE,                              \
index b38dc6dcebc37d62e3d81073070c239c3e4c8c64..4f3234563018a85ca8f99c4695e65d7523da4d8d 100644 (file)
@@ -2015,7 +2015,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end)
        RETVAL_ZVAL_FAST(val);
 
        /* Delete the first or last value */
-       zend_hash_get_current_key_ex(Z_ARRVAL_P(stack), &key, &index, 0, NULL);
+       zend_hash_get_current_key(Z_ARRVAL_P(stack), &key, &index, 0);
        if (key && Z_ARRVAL_P(stack) == &EG(symbol_table).ht) {
                zend_delete_global_variable(key TSRMLS_CC);
        } else if (key) {
index fc5727d7ce97565559881e1de1c3b26989ffd16c..46af753ecc24b029f508b1ab057b0e2992186235 100644 (file)
@@ -55,7 +55,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
        arg_sep_len = strlen(arg_sep);
 
        for (zend_hash_internal_pointer_reset(ht);
-               (key_type = zend_hash_get_current_key_ex(ht, &key, &idx, 0, NULL)) != HASH_KEY_NON_EXISTENT;
+               (key_type = zend_hash_get_current_key(ht, &key, &idx, 0)) != HASH_KEY_NON_EXISTENT;
                zend_hash_move_forward(ht)
        ) {
                /* handling for private & protected object properties */
@@ -78,7 +78,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
                        prop_len = 0;
                }
 
-               if ((zdata = zend_hash_get_current_data_ex(ht, NULL)) == NULL) {
+               if ((zdata = zend_hash_get_current_data(ht)) == NULL) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error traversing form data array");
                        return FAILURE;
                }
index 307bacd10ac3563d7e3c24b8a2e1321a3c6e3ae0..ea2278a76b61503cabebcc58f5d2e1f3b3ab2ffc 100644 (file)
@@ -214,7 +214,7 @@ static void php_print_gpcse_array(char *name, uint name_length TSRMLS_DC)
                        php_info_print(name);
                        php_info_print("[\"");
 
-                       switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(data), &string_key, &num_key, 0, NULL)) {
+                       switch (zend_hash_get_current_key(Z_ARRVAL_P(data), &string_key, &num_key, 0)) {
                                case HASH_KEY_IS_STRING:
                                        if (!sapi_module.phpinfo_as_text) {
                                                php_info_print_html_esc(string_key->val, string_key->len);
index 3524ae9c63405d4413eb88c04157810ed0ffc454..6da9a008f53103d5e74434142662ce28a0291872 100644 (file)
@@ -664,8 +664,8 @@ static int stream_array_from_fd_set(zval *stream_array, fd_set *fds TSRMLS_DC)
                int tmp_fd;
 
 
-               type = zend_hash_get_current_key_ex(Z_ARRVAL_P(stream_array),
-                               &key, &num_ind, 0, NULL);
+               type = zend_hash_get_current_key(Z_ARRVAL_P(stream_array),
+                               &key, &num_ind, 0);
                if (type == HASH_KEY_NON_EXISTENT ||
                        (elem = zend_hash_get_current_data(Z_ARRVAL_P(stream_array))) == NULL) {
                        continue; /* should not happen */
index e353b5d536c7e152b1fda2f5e6c9482495dc02f3..f671e1ebf03c5d1223e563b412d34666dcb69370 100644 (file)
@@ -3958,8 +3958,8 @@ static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensit
                                COPY_PZVAL_TO_ZVAL(result, subject_entry);
                        }
                        /* Add to return array */
-                       switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(subject), &string_key,
-                                                                                               &num_key, 0, NULL)) {
+                       switch (zend_hash_get_current_key(Z_ARRVAL_P(subject), &string_key,
+                                                                                               &num_key, 0)) {
                                case HASH_KEY_IS_STRING:
                                        zend_hash_update(Z_ARRVAL_P(return_value), string_key, &result);
                                        break;
index 9e720aea49828c4927726107cada56f42c1b14e3..00702f0fb93613f58c5b9b7c880d53222cc522b3 100644 (file)
@@ -544,7 +544,7 @@ PHP_FUNCTION(stream_get_filters)
 
        if (filters_hash) {
                for(zend_hash_internal_pointer_reset(filters_hash);
-                       (key_flags = zend_hash_get_current_key_ex(filters_hash, &filter_name, &num_key, 0, NULL)) != HASH_KEY_NON_EXISTENT;
+                       (key_flags = zend_hash_get_current_key(filters_hash, &filter_name, &num_key, 0)) != HASH_KEY_NON_EXISTENT;
                        zend_hash_move_forward(filters_hash))
                                if (key_flags == HASH_KEY_IS_STRING) {
                                        add_next_index_str(return_value, STR_COPY(filter_name));
index a1b2cecabc0dae628c485dc034dc4f142ab750ce..024dbe682194bb15e18a00207d5d867fa1d5ac8b 100644 (file)
@@ -765,7 +765,7 @@ PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int
 
        /* Walk through config hash and alter matching ini entries using the values found in the hash */
        for (zend_hash_internal_pointer_reset(source_hash);
-               zend_hash_get_current_key_ex(source_hash, &str, &num_index, 0, NULL) == HASH_KEY_IS_STRING;
+               zend_hash_get_current_key(source_hash, &str, &num_index, 0) == HASH_KEY_IS_STRING;
                zend_hash_move_forward(source_hash)
        ) {
                data = zend_hash_get_current_data(source_hash);