zend_hash_get_current_key_ex does not accept NULL for position anymore
authorMichael Wallner <mike@php.net>
Sun, 18 Jan 2015 09:38:11 +0000 (10:38 +0100)
committerMichael Wallner <mike@php.net>
Sun, 18 Jan 2015 09:38:11 +0000 (10:38 +0100)
php_http_env.c
php_http_env_response.c
php_http_header.c
php_http_misc.h
php_http_negotiate.h
php_http_params.c

index a2390b3284f08e88387f9742eadcec283a8f42bd..a2c3227ea94127d85a2b6b3dfc3bec3dcc8c8d3d 100644 (file)
@@ -33,7 +33,7 @@ PHP_RINIT_FUNCTION(http_env)
                        zend_string *key_str;
                        zend_ulong key_num;
 
-                       if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(&params, &key_str, &key_num, NULL)) {
+                       if (HASH_KEY_IS_STRING == zend_hash_get_current_key(&params, &key_str, &key_num)) {
                                sapi_post_entry *post_entry = NULL;
 
                                if ((post_entry = zend_hash_find_ptr(&SG(known_post_content_types), key_str))) {
index f9e8c4cb43ce7045679a3963810e5ac06270df9c..34bc75393732a41b6aff9c86d48b0217da577503 100644 (file)
@@ -502,7 +502,7 @@ static ZEND_RESULT_CODE php_http_env_response_send_head(php_http_env_response_t
                                                zend_ulong index = 0;
 
                                                zend_hash_internal_pointer_reset(result);
-                                               if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(result, &key_str, &index, NULL)) {
+                                               if (HASH_KEY_IS_STRING == zend_hash_get_current_key(result, &key_str, &index)) {
                                                        if (zend_string_equals_literal(key_str, "gzip")) {
                                                                if (!(r->content.encoder = php_http_encoding_stream_init(NULL, php_http_encoding_stream_get_deflate_ops(), PHP_HTTP_DEFLATE_TYPE_GZIP))) {
                                                                        ret = FAILURE;
index 709b85bb3cea22f528bd3b13bb2adaeaa77ec16e..0ae381ea1469058fbd4e812effc7bcb3ccd4cb12 100644 (file)
@@ -187,7 +187,7 @@ PHP_METHOD(HttpHeader, unserialize)
                                zend_ulong idx;
 
                                zend_hash_internal_pointer_reset(&ht);
-                               switch (zend_hash_get_current_key_ex(&ht, &key, &idx, NULL)) {
+                               switch (zend_hash_get_current_key(&ht, &key, &idx)) {
                                        case HASH_KEY_IS_STRING:
                                                zend_update_property_str(php_http_header_class_entry, getThis(), ZEND_STRL("name"), key);
                                                break;
index 204d0e30497f440703f6496d1a75fc4464178b20..32f2bc5d2ee0da75892b2892648315421184db39 100644 (file)
@@ -176,6 +176,9 @@ static inline ZEND_RESULT_CODE php_http_ini_entry(const char *name_str, size_t n
        return FAILURE;
 }
 
+#define Z_ISUSER(zv) (Z_TYPE(zv) <= 10)
+#define Z_ISUSER_P(zvp) Z_ISUSER(*(zvp))
+
 #define RETVAL_STR_COPY(zs) ZVAL_STR_COPY(return_value, zs)
 #define RETURN_STR_COPY(zs) do { \
        ZVAL_STR_COPY(return_value, zs); \
index 598e871cd03407b95f32ee3bea014a5172fa5cdb..58b709386d3d6df13949e0833f87b9be269399c6 100644 (file)
@@ -102,7 +102,7 @@ static inline HashTable *php_http_negotiate_content_type(HashTable *supported, p
                zend_string *key; \
                zend_ulong idx; \
                 \
-               if (zend_hash_num_elements(result) && HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(result, &key, &idx, NULL)) { \
+               if (zend_hash_num_elements(result) && HASH_KEY_IS_STRING == zend_hash_get_current_key(result, &key, &idx)) { \
                        RETVAL_STR_COPY(key); \
                } else { \
                        PHP_HTTP_DO_NEGOTIATE_DEFAULT(supported); \
index ad32f0e58155a3dd83bde7109a28435f73979970..2f73cb93d8e8d7af676fbe83f65c0564c2ad4458 100644 (file)
@@ -397,7 +397,7 @@ static void merge_param(HashTable *params, zval *zdata, zval **current_param, zv
        }
 #endif
 
-       zend_hash_get_current_key_ex(Z_ARRVAL_P(zdata), &hkey.key, &hkey.h, NULL);
+       zend_hash_get_current_key(Z_ARRVAL_P(zdata), &hkey.key, &hkey.h);
 
        if ((hkey.key && !zend_hash_exists(params, hkey.key))
        ||      (!hkey.key && !zend_hash_index_exists(params, hkey.h))
@@ -444,7 +444,7 @@ static void merge_param(HashTable *params, zval *zdata, zval **current_param, zv
                        while (Z_TYPE_P(zdata_ptr) == IS_ARRAY && (test_ptr = zend_hash_get_current_data(Z_ARRVAL_P(zdata_ptr)))) {
                                if (Z_TYPE_P(test_ptr) == IS_ARRAY) {
                                        /* now find key in ptr */
-                                       if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(zdata_ptr), &hkey.key, &hkey.h, NULL)) {
+                                       if (HASH_KEY_IS_STRING == zend_hash_get_current_key(Z_ARRVAL_P(zdata_ptr), &hkey.key, &hkey.h)) {
                                                if ((ptr = zend_hash_find(Z_ARRVAL_P(ptr), hkey.key))) {
                                                        zdata_ptr = test_ptr;
                                                } else {
@@ -472,7 +472,7 @@ static void merge_param(HashTable *params, zval *zdata, zval **current_param, zv
                                                zval_dtor(ptr);
                                                array_init(ptr);
                                        }
-                                       if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(zdata_ptr), &hkey.key, &hkey.h, NULL)) {
+                                       if (HASH_KEY_IS_STRING == zend_hash_get_current_key(Z_ARRVAL_P(zdata_ptr), &hkey.key, &hkey.h)) {
                                                ptr = zend_hash_update(Z_ARRVAL_P(ptr), hkey.key, test_ptr);
                                        } else if (hkey.h) {
                                                ptr = zend_hash_index_update(Z_ARRVAL_P(ptr), hkey.h, test_ptr);
@@ -543,10 +543,11 @@ static void push_param(HashTable *params, php_http_params_state_t *state, const
                        ZVAL_NULL(&key);
                        sanitize_key(opts->flags, state->param.str, state->param.len, &key, &rfc5987);
                        state->rfc5987 = rfc5987;
-                       if (Z_TYPE(key) != IS_STRING) {
+                       if (Z_TYPE(key) == IS_ARRAY) {
                                merge_param(params, &key, &state->current.val, &state->current.args);
-                       } else if (Z_STRLEN(key)) {
-                               array_init_size(&prm, 2);
+                       } else if (Z_TYPE(key) == IS_STRING && Z_STRLEN(key)) {
+                               //array_init_size(&prm, 2);
+                               array_init(&prm);
 
                                if (!Z_ISUNDEF(opts->defval)) {
                                        ZVAL_COPY_VALUE(&val, &opts->defval);
@@ -559,8 +560,8 @@ static void push_param(HashTable *params, php_http_params_state_t *state, const
                                } else {
                                        state->current.val = zend_hash_str_update(Z_ARRVAL(prm), "value", lenof("value"), &val);
                                }
-
-                               array_init_size(&arg, 3);
+                               //array_init_size(&arg, 3);
+                               array_init(&arg);
                                state->current.args = zend_hash_str_update(Z_ARRVAL(prm), "arguments", lenof("arguments"), &arg);
                                state->current.param = zend_symtable_str_update(params, Z_STRVAL(key), Z_STRLEN(key), &prm);
                        }
@@ -712,7 +713,7 @@ static inline void shift_rfc5987(php_http_buffer_t *buf, zval *zvalue, const cha
        php_http_arrkey_t key = {0};
 
        if ((zdata = zend_hash_get_current_data(ht))
-       &&      HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex(ht, &key.key, &key.h, NULL)
+       &&      HASH_KEY_NON_EXISTENT != zend_hash_get_current_key(ht, &key.key, &key.h)
        ) {
                php_http_arrkey_stringify(&key, NULL);
                php_http_buffer_appendf(buf, "*%.*sutf-8'%.*s'",