summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/soap/php_encoding.c9
-rw-r--r--ext/soap/php_http.c24
-rw-r--r--ext/soap/soap.c41
3 files changed, 46 insertions, 28 deletions
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 3ac5a7bad4..9866d94c3f 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -3514,18 +3514,21 @@ static encodePtr get_array_type(xmlNodePtr node, zval *array, smart_str *type)
Z_OBJCE_P(tmp) == soap_var_class_entry) {
zval *ztype;
- if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_type", sizeof("enc_type")-1)) == NULL) {
+ if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_type", sizeof("enc_type")-1)) == NULL ||
+ Z_TYPE_P(ztype) != IS_LONG) {
soap_error0(E_ERROR, "Encoding: SoapVar has no 'enc_type' property");
}
cur_type = Z_LVAL_P(ztype);
- if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_stype", sizeof("enc_stype")-1)) != NULL) {
+ if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_stype", sizeof("enc_stype")-1)) != NULL &&
+ Z_TYPE_P(ztype) == IS_STRING) {
cur_stype = Z_STRVAL_P(ztype);
} else {
cur_stype = NULL;
}
- if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_ns", sizeof("enc_ns")-1)) != NULL) {
+ if ((ztype = zend_hash_str_find(Z_OBJPROP_P(tmp), "enc_ns", sizeof("enc_ns")-1)) != NULL &&
+ Z_TYPE_P(ztype) == IS_STRING) {
cur_ns = Z_STRVAL_P(ztype);
} else {
cur_ns = NULL;
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index db0e3c14ca..645d1f24ca 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -36,13 +36,15 @@ int proxy_authentication(zval* this_ptr, smart_str* soap_headers)
{
zval *login, *password;
- if ((login = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_login", sizeof("_proxy_login")-1)) != NULL) {
+ if ((login = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_login", sizeof("_proxy_login")-1)) != NULL &&
+ Z_TYPE_P(login) == IS_STRING) {
zend_string *buf;
smart_str auth = {0};
smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login));
smart_str_appendc(&auth, ':');
- if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_password", sizeof("_proxy_password")-1)) != NULL) {
+ if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_password", sizeof("_proxy_password")-1)) != NULL &&
+ Z_TYPE_P(password) == IS_STRING) {
smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password));
}
smart_str_0(&auth);
@@ -63,13 +65,15 @@ int basic_authentication(zval* this_ptr, smart_str* soap_headers)
zval *login, *password;
if ((login = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_login", sizeof("_login")-1)) != NULL &&
- !zend_hash_str_exists(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest")-1)) {
+ Z_TYPE_P(login) == IS_STRING &&
+ !zend_hash_str_exists(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest")-1)) {
zend_string* buf;
smart_str auth = {0};
smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login));
smart_str_appendc(&auth, ':');
- if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL) {
+ if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL &&
+ Z_TYPE_P(password) == IS_STRING) {
smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password));
}
smart_str_0(&auth);
@@ -565,7 +569,7 @@ try_again:
}
if (!http_1_1 ||
((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_keep_alive", sizeof("_keep_alive")-1)) != NULL &&
- Z_LVAL_P(tmp) == 0)) {
+ (Z_TYPE_P(tmp) == IS_FALSE || (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 0)))) {
smart_str_append_const(&soap_headers, "\r\n"
"Connection: close\r\n");
} else {
@@ -797,7 +801,8 @@ try_again:
}
/* Send cookies along with request */
- if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) != NULL) {
+ if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) != NULL &&
+ Z_TYPE_P(cookies) == IS_ARRAY) {
zval *data;
zend_string *key;
int i, n;
@@ -840,7 +845,7 @@ try_again:
smart_str_append_const(&soap_headers, "\r\n");
smart_str_0(&soap_headers);
if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL &&
- Z_LVAL_P(trace) > 0) {
+ (Z_TYPE_P(trace) == IS_TRUE || (Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) != 0))) {
add_property_stringl(this_ptr, "__last_request_headers", soap_headers.s->val, soap_headers.s->len);
}
smart_str_appendl(&soap_headers, request, request_size);
@@ -885,7 +890,7 @@ try_again:
}
if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL &&
- Z_LVAL_P(trace) > 0) {
+ (Z_TYPE_P(trace) == IS_TRUE || (Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) != 0))) {
add_property_str(this_ptr, "__last_response_headers", zend_string_copy(http_headers));
}
@@ -934,7 +939,8 @@ try_again:
char *eqpos, *sempos;
zval *cookies;
- if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) == NULL) {
+ if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) == NULL ||
+ Z_TYPE_P(cookies) != IS_ARRAY) {
zval tmp_cookies;
array_init(&tmp_cookies);
cookies = zend_hash_str_update(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1, &tmp_cookies);
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 3a27f7a7b4..a4f4ab5e6d 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -2581,7 +2581,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
}
if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL &&
- Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) > 0) {
+ (Z_TYPE_P(trace) == IS_TRUE || (Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) != 0))) {
add_property_stringl(this_ptr, "__last_request", buf, buf_size);
}
@@ -2609,7 +2609,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
}
ret = FALSE;
} else if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL &&
- Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) > 0) {
+ (Z_TYPE_P(trace) == IS_TRUE || (Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) != 0))) {
add_property_str(this_ptr, "__last_response", zend_string_copy(Z_STR_P(response)));
}
zval_ptr_dtor(&func);
@@ -2655,13 +2655,13 @@ static void do_soap_call(zend_execute_data *execute_data,
SOAP_CLIENT_BEGIN_CODE();
- if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL
- && Z_LVAL_P(trace) > 0) {
+ if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL &&
+ (Z_TYPE_P(trace) == IS_TRUE || (Z_TYPE_P(trace) == IS_LONG && Z_LVAL_P(trace) != 0))) {
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request")-1);
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response")-1);
}
- if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_soap_version", sizeof("_soap_version")-1)) != NULL
- && Z_LVAL_P(tmp) == SOAP_1_2) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_soap_version", sizeof("_soap_version")-1)) != NULL &&
+ Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == SOAP_1_2) {
soap_version = SOAP_1_2;
} else {
soap_version = SOAP_1_1;
@@ -2758,7 +2758,7 @@ static void do_soap_call(zend_execute_data *execute_data,
zval *uri;
smart_str action = {0};
- if ((uri = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "uri", sizeof("uri")-1)) == NULL) {
+ if ((uri = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "uri", sizeof("uri")-1)) == NULL || Z_TYPE_P(uri) != IS_STRING) {
add_soap_fault(this_ptr, "Client", "Error finding \"uri\" property", NULL, NULL);
} else if (location == NULL) {
add_soap_fault(this_ptr, "Client", "Error could not find \"location\" property", NULL, NULL);
@@ -3018,7 +3018,8 @@ PHP_METHOD(SoapClient, __getLastRequest)
return;
}
- if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_request", sizeof("__last_request")-1)) != NULL) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_request", sizeof("__last_request")-1)) != NULL &&
+ Z_TYPE_P(tmp) == IS_STRING) {
RETURN_STR(zend_string_copy(Z_STR_P(tmp)));
}
RETURN_NULL();
@@ -3036,7 +3037,8 @@ PHP_METHOD(SoapClient, __getLastResponse)
return;
}
- if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_response", sizeof("__last_response")-1)) != NULL) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_response", sizeof("__last_response")-1)) != NULL &&
+ Z_TYPE_P(tmp) == IS_STRING) {
RETURN_STR(zend_string_copy(Z_STR_P(tmp)));
}
RETURN_NULL();
@@ -3054,7 +3056,8 @@ PHP_METHOD(SoapClient, __getLastRequestHeaders)
return;
}
- if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_request_headers", sizeof("__last_request_headers")-1)) != NULL) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_request_headers", sizeof("__last_request_headers")-1)) != NULL &&
+ Z_TYPE_P(tmp) == IS_STRING) {
RETURN_STR(zend_string_copy(Z_STR_P(tmp)));
}
RETURN_NULL();
@@ -3072,7 +3075,8 @@ PHP_METHOD(SoapClient, __getLastResponseHeaders)
return;
}
- if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_response_headers", sizeof("__last_response_headers")-1)) != NULL) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(getThis()), "__last_response_headers", sizeof("__last_response_headers")-1)) != NULL &&
+ Z_TYPE_P(tmp) == IS_STRING) {
RETURN_STR(zend_string_copy(Z_STR_P(tmp)));
}
RETURN_NULL();
@@ -3129,13 +3133,15 @@ PHP_METHOD(SoapClient, __setCookie)
}
if (val == NULL) {
- if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) != NULL) {
+ if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) != NULL &&
+ Z_TYPE_P(cookies) == IS_ARRAY) {
zend_hash_str_del(Z_ARRVAL_P(cookies), name, name_len);
}
} else {
zval zcookie;
- if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) == NULL) {
+ if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) == NULL ||
+ Z_TYPE_P(cookies) != IS_ARRAY) {
zval tmp_cookies;
array_init(&tmp_cookies);
@@ -3160,7 +3166,8 @@ PHP_METHOD(SoapClient, __getCookies)
}
- if ((cookies = zend_hash_str_find(Z_OBJPROP_P(getThis()), "_cookies", sizeof("_cookies")-1)) != NULL) {
+ if ((cookies = zend_hash_str_find(Z_OBJPROP_P(getThis()), "_cookies", sizeof("_cookies")-1)) != NULL &&
+ Z_TYPE_P(cookies) == IS_ARRAY) {
ZVAL_ARR(return_value, zend_array_dup(Z_ARRVAL_P(cookies)));
} else {
array_init(return_value);
@@ -4240,7 +4247,8 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function
}
}
} else {
- if ((zstyle = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "style", sizeof("style")-1)) != NULL) {
+ if ((zstyle = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "style", sizeof("style")-1)) != NULL &&
+ Z_TYPE_P(zstyle) == IS_LONG) {
style = Z_LVAL_P(zstyle);
} else {
style = SOAP_RPC;
@@ -4263,7 +4271,7 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function
}
if ((zuse = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "use", sizeof("use")-1)) != NULL &&
- Z_LVAL_P(zuse) == SOAP_LITERAL) {
+ Z_TYPE_P(zuse) == IS_LONG && Z_LVAL_P(zuse) == SOAP_LITERAL) {
use = SOAP_LITERAL;
} else {
use = SOAP_ENCODED;
@@ -4391,6 +4399,7 @@ static xmlNodePtr serialize_parameter(sdlParamPtr param, zval *param_val, int in
zval *param_data;
if ((param_name = zend_hash_str_find(Z_OBJPROP_P(param_val), "param_name", sizeof("param_name")-1)) != NULL &&
+ Z_TYPE_P(param_name) == IS_STRING &&
(param_data = zend_hash_str_find(Z_OBJPROP_P(param_val), "param_data", sizeof("param_data")-1)) != NULL) {
param_val = param_data;
name = Z_STRVAL_P(param_name);