diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-07-16 12:07:09 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-07-16 12:20:16 +0200 |
commit | 290e520c03ca54185ee98b2fc5807c6d018a38db (patch) | |
tree | 2d115c2d793bc2a008bc6ba42b5aa5553fe84b63 /ext/soap/php_http.c | |
parent | c9acc9018629d046679fcdccabd4a4f556b87499 (diff) | |
download | php-git-290e520c03ca54185ee98b2fc5807c6d018a38db.tar.gz |
Use ZEND_HASH_FOREACH APIs in a few more places
Diffstat (limited to 'ext/soap/php_http.c')
-rw-r--r-- | ext/soap/php_http.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 5938a2e081..f854faf15d 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -833,20 +833,13 @@ try_again: Z_TYPE_P(cookies) == IS_ARRAY) { zval *data; zend_string *key; - int i, n; - + uint32_t n = zend_hash_num_elements(Z_ARRVAL_P(cookies)); has_cookies = 1; - n = zend_hash_num_elements(Z_ARRVAL_P(cookies)); if (n > 0) { - zend_hash_internal_pointer_reset(Z_ARRVAL_P(cookies)); smart_str_append_const(&soap_headers, "Cookie: "); - for (i = 0; i < n; i++) { - zend_ulong numindx; - int res = zend_hash_get_current_key(Z_ARRVAL_P(cookies), &key, &numindx); - data = zend_hash_get_current_data(Z_ARRVAL_P(cookies)); - - if (res == HASH_KEY_IS_STRING && Z_TYPE_P(data) == IS_ARRAY) { - zval *value; + ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(cookies), key, data) { + if (key && Z_TYPE_P(data) == IS_ARRAY) { + zval *value; if ((value = zend_hash_index_find(Z_ARRVAL_P(data), 0)) != NULL && Z_TYPE_P(value) == IS_STRING) { @@ -865,8 +858,7 @@ try_again: } } } - zend_hash_move_forward(Z_ARRVAL_P(cookies)); - } + } ZEND_HASH_FOREACH_END(); smart_str_append_const(&soap_headers, "\r\n"); } } |