summaryrefslogtreecommitdiff
path: root/ext/soap/php_http.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/soap/php_http.c')
-rw-r--r--ext/soap/php_http.c40
1 files changed, 12 insertions, 28 deletions
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 75dbdf069e..ee3dcbdc9a 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2018 The PHP Group |
+ | Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -835,20 +835,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) {
@@ -867,8 +860,7 @@ try_again:
}
}
}
- zend_hash_move_forward(Z_ARRVAL_P(cookies));
- }
+ } ZEND_HASH_FOREACH_END();
smart_str_append_const(&soap_headers, "\r\n");
}
}
@@ -1466,7 +1458,7 @@ static zend_string* get_http_body(php_stream *stream, int close, char *headers)
php_stream_gets(stream, headerbuf, sizeof(headerbuf));
if (sscanf(headerbuf, "%x", &buf_size) > 0 ) {
if (buf_size > 0) {
- int len_size = 0;
+ size_t len_size = 0;
if (http_buf_size + buf_size + 1 < 0) {
if (http_buf) {
@@ -1482,7 +1474,7 @@ static zend_string* get_http_body(php_stream *stream, int close, char *headers)
}
while (len_size < buf_size) {
- int len_read = php_stream_read(stream, http_buf->val + http_buf_size, buf_size - len_size);
+ ssize_t len_read = php_stream_read(stream, http_buf->val + http_buf_size, buf_size - len_size);
if (len_read <= 0) {
/* Error or EOF */
done = TRUE;
@@ -1498,7 +1490,7 @@ static zend_string* get_http_body(php_stream *stream, int close, char *headers)
ch = php_stream_getc(stream);
}
if (ch != '\n') {
- /* Somthing wrong in chunked encoding */
+ /* Something wrong in chunked encoding */
if (http_buf) {
zend_string_release_ex(http_buf, 0);
}
@@ -1506,7 +1498,7 @@ static zend_string* get_http_body(php_stream *stream, int close, char *headers)
}
}
} else {
- /* Somthing wrong in chunked encoding */
+ /* Something wrong in chunked encoding */
if (http_buf) {
zend_string_release_ex(http_buf, 0);
}
@@ -1540,7 +1532,7 @@ static zend_string* get_http_body(php_stream *stream, int close, char *headers)
}
http_buf = zend_string_alloc(header_length, 0);
while (http_buf_size < header_length) {
- int len_read = php_stream_read(stream, http_buf->val + http_buf_size, header_length - http_buf_size);
+ ssize_t len_read = php_stream_read(stream, http_buf->val + http_buf_size, header_length - http_buf_size);
if (len_read <= 0) {
break;
}
@@ -1548,7 +1540,7 @@ static zend_string* get_http_body(php_stream *stream, int close, char *headers)
}
} else if (header_close) {
do {
- int len_read;
+ ssize_t len_read;
if (http_buf) {
http_buf = zend_string_realloc(http_buf, http_buf_size + 4096, 0);
} else {
@@ -1588,11 +1580,3 @@ static zend_string *get_http_headers(php_stream *stream)
smart_str_free(&tmp_response);
return NULL;
}
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: sw=4 ts=4 fdm=marker
- * vim<600: sw=4 ts=4
- */