af9dc8
Adapted for 5.4.16
af9dc8
af9dc8
From d5248f67b58ac3107fec82c5b937fc3f4c89784a Mon Sep 17 00:00:00 2001
af9dc8
From: Dmitry Stogov <dmitry@zend.com>
af9dc8
Date: Mon, 2 Mar 2015 12:27:36 +0300
af9dc8
Subject: [PATCH] Check variable type before its usage as IS_ARRAY.
af9dc8
af9dc8
---
af9dc8
 ext/soap/soap.c | 3 ++-
af9dc8
 1 file changed, 2 insertions(+), 1 deletion(-)
af9dc8
af9dc8
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
af9dc8
index eaa57d9..8790605 100644
af9dc8
--- a/ext/soap/soap.c
af9dc8
+++ b/ext/soap/soap.c
af9dc8
@@ -2879,7 +2879,8 @@ PHP_METHOD(SoapClient, __call)
af9dc8
 	}
af9dc8
 
af9dc8
 	/* Add default headers */
af9dc8
-	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers"), (void **) &tmp)==SUCCESS) {
af9dc8
+	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers"), (void **) &tmp)==SUCCESS &&
af9dc8
+	    Z_TYPE_PP(tmp) == IS_ARRAY) {
af9dc8
 		HashTable *default_headers = Z_ARRVAL_P(*tmp);
af9dc8
 		if (soap_headers) {
af9dc8
 			if (!free_soap_headers) {
af9dc8
-- 
af9dc8
2.1.4
af9dc8
af9dc8
From 0c136a2abd49298b66acb0cad504f0f972f5bfe8 Mon Sep 17 00:00:00 2001
af9dc8
From: Dmitry Stogov <dmitry@zend.com>
af9dc8
Date: Tue, 3 Mar 2015 09:44:46 +0300
af9dc8
Subject: [PATCH] Added type checks
af9dc8
af9dc8
---
af9dc8
 ext/soap/php_encoding.c |  9 ++++++---
af9dc8
 ext/soap/php_http.c     | 23 +++++++++++++++--------
af9dc8
 ext/soap/soap.c         | 41 +++++++++++++++++++++++++----------------
af9dc8
 3 files changed, 46 insertions(+), 27 deletions(-)
af9dc8
af9dc8
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
af9dc8
index 5e93b8a..fd9e367 100644
af9dc8
--- a/ext/soap/php_encoding.c
af9dc8
+++ b/ext/soap/php_encoding.c
af9dc8
@@ -3649,18 +3649,21 @@ static encodePtr get_array_type(xmlNodePtr node, zval *array, smart_str *type TS
af9dc8
 		    Z_OBJCE_PP(tmp) == soap_var_class_entry) {
af9dc8
 			zval **ztype;
af9dc8
 
af9dc8
-			if (zend_hash_find(Z_OBJPROP_PP(tmp), "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE) {
af9dc8
+			if (zend_hash_find(Z_OBJPROP_PP(tmp), "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE ||
af9dc8
+			    Z_TYPE_PP(ztype) != IS_LONG) {
af9dc8
 				soap_error0(E_ERROR,  "Encoding: SoapVar has no 'enc_type' property");
af9dc8
 			}
af9dc8
 			cur_type = Z_LVAL_PP(ztype);
af9dc8
 
af9dc8
-			if (zend_hash_find(Z_OBJPROP_PP(tmp), "enc_stype", sizeof("enc_stype"), (void **)&ztype) == SUCCESS) {
af9dc8
+			if (zend_hash_find(Z_OBJPROP_PP(tmp), "enc_stype", sizeof("enc_stype"), (void **)&ztype) == SUCCESS &&
af9dc8
+			    Z_TYPE_PP(ztype) == IS_STRING) {
af9dc8
 				cur_stype = Z_STRVAL_PP(ztype);
af9dc8
 			} else {
af9dc8
 				cur_stype = NULL;
af9dc8
 			}
af9dc8
 
af9dc8
-			if (zend_hash_find(Z_OBJPROP_PP(tmp), "enc_ns", sizeof("enc_ns"), (void **)&ztype) == SUCCESS) {
af9dc8
+			if (zend_hash_find(Z_OBJPROP_PP(tmp), "enc_ns", sizeof("enc_ns"), (void **)&ztype) == SUCCESS &&
af9dc8
+			    Z_TYPE_PP(ztype) == IS_STRING) {
af9dc8
 				cur_ns = Z_STRVAL_PP(ztype);
af9dc8
 			} else {
af9dc8
 				cur_ns = NULL;
af9dc8
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
af9dc8
index 9e74a7c..8c5082c 100644
af9dc8
--- a/ext/soap/php_http.c
af9dc8
+++ b/ext/soap/php_http.c
af9dc8
@@ -36,14 +36,16 @@ int proxy_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC)
af9dc8
 {
af9dc8
 	zval **login, **password;
af9dc8
 
af9dc8
-	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_login", sizeof("_proxy_login"), (void **)&login) == SUCCESS) {
af9dc8
+	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_login", sizeof("_proxy_login"), (void **)&login) == SUCCESS &&
af9dc8
+	    Z_TYPE_PP(login) == IS_STRING) {
af9dc8
 		unsigned char* buf;
af9dc8
 		int len;
af9dc8
 		smart_str auth = {0};
af9dc8
 
af9dc8
 		smart_str_appendl(&auth, Z_STRVAL_PP(login), Z_STRLEN_PP(login));
af9dc8
 		smart_str_appendc(&auth, ':');
af9dc8
-		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_password", sizeof("_proxy_password"), (void **)&password) == SUCCESS) {
af9dc8
+		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_password", sizeof("_proxy_password"), (void **)&password) == SUCCESS &&
af9dc8
+		    Z_TYPE_PP(password) == IS_STRING) {
af9dc8
 			smart_str_appendl(&auth, Z_STRVAL_PP(password), Z_STRLEN_PP(password));
af9dc8
 		}
af9dc8
 		smart_str_0(&auth);
af9dc8
@@ -64,14 +66,16 @@ int basic_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC)
af9dc8
 	zval **login, **password;
af9dc8
 
af9dc8
 	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_login", sizeof("_login"), (void **)&login) == SUCCESS &&
af9dc8
-			!zend_hash_exists(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest"))) {
af9dc8
+	    Z_TYPE_PP(login) == IS_STRING &&
af9dc8
+	    !zend_hash_exists(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest"))) {
af9dc8
 		unsigned char* buf;
af9dc8
 		int len;
af9dc8
 		smart_str auth = {0};
af9dc8
 
af9dc8
 		smart_str_appendl(&auth, Z_STRVAL_PP(login), Z_STRLEN_PP(login));
af9dc8
 		smart_str_appendc(&auth, ':');
af9dc8
-		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password"), (void **)&password) == SUCCESS) {
af9dc8
+		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password"), (void **)&password) == SUCCESS &&
af9dc8
+		    Z_TYPE_PP(password) == IS_STRING) {
af9dc8
 			smart_str_appendl(&auth, Z_STRVAL_PP(password), Z_STRLEN_PP(password));
af9dc8
 		}
af9dc8
 		smart_str_0(&auth);
af9dc8
@@ -509,6 +513,7 @@ try_again:
af9dc8
 		}
af9dc8
 		if (!http_1_1 ||
af9dc8
 			(zend_hash_find(Z_OBJPROP_P(this_ptr), "_keep_alive", sizeof("_keep_alive"), (void **)&tmp) == SUCCESS &&
af9dc8
+			 (Z_TYPE_PP(tmp) == IS_BOOL || Z_TYPE_PP(tmp) == IS_LONG) &&
af9dc8
 			 Z_LVAL_PP(tmp) == 0)) {
af9dc8
 			smart_str_append_const(&soap_headers, "\r\n"
af9dc8
 				"Connection: close\r\n");
af9dc8
@@ -742,7 +747,8 @@ try_again:
af9dc8
 		}
af9dc8
 
af9dc8
 		/* Send cookies along with request */
af9dc8
-		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS) {
af9dc8
+		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS &&
af9dc8
+		    Z_TYPE_PP(cookies) == IS_ARRAY) {
af9dc8
 			zval **data;
af9dc8
 			char *key;
af9dc8
 			int i, n;
af9dc8
@@ -785,7 +791,7 @@ try_again:
af9dc8
 		smart_str_append_const(&soap_headers, "\r\n");
af9dc8
 		smart_str_0(&soap_headers);
af9dc8
 		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
af9dc8
-		    Z_LVAL_PP(trace) > 0) {
af9dc8
+		    (Z_TYPE_PP(trace) == IS_BOOL || Z_TYPE_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
af9dc8
 			add_property_stringl(this_ptr, "__last_request_headers", soap_headers.c, soap_headers.len, 1);
af9dc8
 		}
af9dc8
 		smart_str_appendl(&soap_headers, request, request_size);
af9dc8
@@ -830,7 +836,7 @@ try_again:
af9dc8
 		}
af9dc8
 
af9dc8
 		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
af9dc8
-		    Z_LVAL_PP(trace) > 0) {
af9dc8
+		    (Z_TYPE_PP(trace) == IS_BOOL || Z_TYPE_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
af9dc8
 			add_property_stringl(this_ptr, "__last_response_headers", http_headers, http_header_size, 1);
af9dc8
 		}
af9dc8
 
af9dc8
@@ -879,7 +885,8 @@ try_again:
af9dc8
 		char *eqpos, *sempos;
af9dc8
 		zval **cookies;
af9dc8
 
af9dc8
-		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == FAILURE) {
af9dc8
+		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == FAILURE ||
af9dc8
+		    Z_TYPE_PP(cookies) != IS_ARRAY) {
af9dc8
 			zval *tmp_cookies;
af9dc8
 			MAKE_STD_ZVAL(tmp_cookies);
af9dc8
 			array_init(tmp_cookies);
af9dc8
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
af9dc8
index 8790605..9ec6347 100644
af9dc8
--- a/ext/soap/soap.c
af9dc8
+++ b/ext/soap/soap.c
af9dc8
@@ -2549,7 +2549,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
af9dc8
 	}
af9dc8
 
af9dc8
 	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
af9dc8
-	    Z_LVAL_PP(trace) > 0) {
af9dc8
+	    (Z_LVAL_PP(trace) == IS_BOOL || Z_LVAL_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
af9dc8
 		add_property_stringl(this_ptr, "__last_request", buf, buf_size, 1);
af9dc8
 	}
af9dc8
 
af9dc8
@@ -2589,7 +2589,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
af9dc8
 		}
af9dc8
 		ret = FALSE;
af9dc8
 	} else if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
af9dc8
-	    Z_LVAL_PP(trace) > 0) {
af9dc8
+	           (Z_LVAL_PP(trace) == IS_BOOL || Z_LVAL_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
af9dc8
 		add_property_stringl(this_ptr, "__last_response", Z_STRVAL_P(response), Z_STRLEN_P(response), 1);
af9dc8
 	}
af9dc8
 	xmlFree(buf);
af9dc8
@@ -2628,13 +2628,13 @@ static void do_soap_call(zval* this_ptr,
af9dc8
 
af9dc8
 	SOAP_CLIENT_BEGIN_CODE();
af9dc8
 
af9dc8
-	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS
af9dc8
-		&& Z_LVAL_PP(trace) > 0) {
af9dc8
+	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
af9dc8
+	    (Z_LVAL_PP(trace) == IS_BOOL || Z_LVAL_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
af9dc8
 		zend_hash_del(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request"));
af9dc8
 		zend_hash_del(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response"));
af9dc8
 	}
af9dc8
-	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_soap_version", sizeof("_soap_version"), (void **) &tmp) == SUCCESS
af9dc8
-		&& Z_LVAL_PP(tmp) == SOAP_1_2) {
af9dc8
+	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_soap_version", sizeof("_soap_version"), (void **) &tmp) == SUCCESS &&
af9dc8
+		Z_TYPE_PP(tmp) == IS_LONG && Z_LVAL_PP(tmp) == SOAP_1_2) {
af9dc8
 		soap_version = SOAP_1_2;
af9dc8
 	} else {
af9dc8
 		soap_version = SOAP_1_1;
af9dc8
@@ -2730,7 +2730,7 @@ static void do_soap_call(zval* this_ptr,
af9dc8
 		zval **uri;
af9dc8
 		smart_str action = {0};
af9dc8
 
af9dc8
-		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "uri", sizeof("uri"), (void *)&uri) == FAILURE) {
af9dc8
+		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "uri", sizeof("uri"), (void *)&uri) == FAILURE || Z_TYPE_PP(uri) != IS_STRING) {
af9dc8
 			add_soap_fault(this_ptr, "Client", "Error finding \"uri\" property", NULL, NULL TSRMLS_CC);
af9dc8
 		} else if (location == NULL) {
af9dc8
 			add_soap_fault(this_ptr, "Client", "Error could not find \"location\" property", NULL, NULL TSRMLS_CC);
af9dc8
@@ -3001,7 +3001,8 @@ PHP_METHOD(SoapClient, __getLastRequest)
af9dc8
 		return;
af9dc8
 	}
af9dc8
 
af9dc8
-	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request"), (void **)&tmp) == SUCCESS) {
af9dc8
+	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request"), (void **)&tmp) == SUCCESS &&
af9dc8
+	    Z_TYPE_PP(tmp) == IS_STRING) {
af9dc8
 		RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
af9dc8
 	}
af9dc8
 	RETURN_NULL();
af9dc8
@@ -3019,7 +3020,8 @@ PHP_METHOD(SoapClient, __getLastResponse)
af9dc8
 		return;
af9dc8
 	}
af9dc8
 	
af9dc8
-	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response"), (void **)&tmp) == SUCCESS) {
af9dc8
+	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response"), (void **)&tmp) == SUCCESS &&
af9dc8
+	    Z_TYPE_PP(tmp) == IS_STRING) {
af9dc8
 		RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
af9dc8
 	}
af9dc8
 	RETURN_NULL();
af9dc8
@@ -3037,7 +3039,8 @@ PHP_METHOD(SoapClient, __getLastRequestHeaders)
af9dc8
 		return;
af9dc8
 	}
af9dc8
 	
af9dc8
-	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_request_headers", sizeof("__last_request_headers"), (void **)&tmp) == SUCCESS) {
af9dc8
+	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_request_headers", sizeof("__last_request_headers"), (void **)&tmp) == SUCCESS &&
af9dc8
+	    Z_TYPE_PP(tmp) == IS_STRING) {
af9dc8
 		RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
af9dc8
 	}
af9dc8
 	RETURN_NULL();
af9dc8
@@ -3055,7 +3058,8 @@ PHP_METHOD(SoapClient, __getLastResponseHeaders)
af9dc8
 		return;
af9dc8
 	}
af9dc8
 
af9dc8
-	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_response_headers", sizeof("__last_response_headers"), (void **)&tmp) == SUCCESS) {
af9dc8
+	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__last_response_headers", sizeof("__last_response_headers"), (void **)&tmp) == SUCCESS &&
af9dc8
+	    Z_TYPE_PP(tmp) == IS_STRING) {
af9dc8
 		RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
af9dc8
 	}
af9dc8
 	RETURN_NULL();
af9dc8
@@ -3111,13 +3115,15 @@ PHP_METHOD(SoapClient, __setCookie)
af9dc8
 	}
af9dc8
 
af9dc8
 	if (val == NULL) {
af9dc8
-		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS) {
af9dc8
+		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS &&
af9dc8
+		    Z_TYPE_PP(cookies) == IS_ARRAY) {
af9dc8
 			zend_hash_del(Z_ARRVAL_PP(cookies), name, name_len+1);
af9dc8
 		}
af9dc8
 	} else {
af9dc8
 		zval *zcookie;
af9dc8
 
af9dc8
-		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == FAILURE) {
af9dc8
+		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == FAILURE ||
af9dc8
+		    Z_TYPE_PP(cookies) != IS_ARRAY) {
af9dc8
 			zval *tmp_cookies;
af9dc8
 
af9dc8
 			MAKE_STD_ZVAL(tmp_cookies);
af9dc8
@@ -4166,7 +4172,8 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function
af9dc8
 			}
af9dc8
 		}
af9dc8
 	} else {
af9dc8
-		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "style", sizeof("style"), (void **)&zstyle) == SUCCESS) {
af9dc8
+		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "style", sizeof("style"), (void **)&zstyle) == SUCCESS &&
af9dc8
+		    Z_TYPE_PP(zstyle) == IS_LONG) {
af9dc8
 			style = Z_LVAL_PP(zstyle);
af9dc8
 		} else {
af9dc8
 			style = SOAP_RPC;
af9dc8
@@ -4189,7 +4196,7 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function
af9dc8
 		}
af9dc8
 
af9dc8
 		if (zend_hash_find(Z_OBJPROP_P(this_ptr), "use", sizeof("use"), (void **)&zuse) == SUCCESS &&
af9dc8
-			  Z_LVAL_PP(zuse) == SOAP_LITERAL) {
af9dc8
+		    Z_TYPE_PP(zuse) == IS_LONG && Z_LVAL_PP(zuse) == SOAP_LITERAL) {
af9dc8
 			use = SOAP_LITERAL;
af9dc8
 		} else {
af9dc8
 			use = SOAP_ENCODED;
af9dc8
@@ -4350,6 +4357,7 @@ static xmlNodePtr serialize_parameter(sdlParamPtr param, zval *param_val, int in
af9dc8
 		zval **param_data;
af9dc8
 
af9dc8
 		if (zend_hash_find(Z_OBJPROP_P(param_val), "param_name", sizeof("param_name"), (void **)&param_name) == SUCCESS &&
af9dc8
+		    Z_TYPE_PP(param_name) == IS_STRING &&
af9dc8
 		    zend_hash_find(Z_OBJPROP_P(param_val), "param_data", sizeof("param_data"), (void **)&param_data) == SUCCESS) {
af9dc8
 			param_val = *param_data;
af9dc8
 			name = Z_STRVAL_PP(param_name);
af9dc8
-- 
af9dc8
2.1.4
af9dc8
af9dc8
From c8eaca013a3922e8383def6158ece2b63f6ec483 Mon Sep 17 00:00:00 2001
af9dc8
From: Dmitry Stogov <dmitry@zend.com>
af9dc8
Date: Tue, 3 Mar 2015 10:43:48 +0300
af9dc8
Subject: [PATCH] Added type checks
af9dc8
af9dc8
---
af9dc8
 ext/soap/php_encoding.c | 21 ++++++++++++++-------
af9dc8
 ext/soap/soap.c         |  6 ++++--
af9dc8
 2 files changed, 18 insertions(+), 9 deletions(-)
af9dc8
af9dc8
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
af9dc8
index fd9e367..31f1f7c 100644
af9dc8
--- a/ext/soap/php_encoding.c
af9dc8
+++ b/ext/soap/php_encoding.c
af9dc8
@@ -404,12 +404,15 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
af9dc8
 		encodePtr enc = NULL;
af9dc8
 		HashTable *ht = Z_OBJPROP_P(data);
af9dc8
 
af9dc8
-		if (zend_hash_find(ht, "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE) {
af9dc8
+		if (zend_hash_find(ht, "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE ||
af9dc8
+		    Z_TYPE_PP(ztype) != IS_LONG) {
af9dc8
 			soap_error0(E_ERROR, "Encoding: SoapVar has no 'enc_type' property");
af9dc8
 		}
af9dc8
 
af9dc8
-		if (zend_hash_find(ht, "enc_stype", sizeof("enc_stype"), (void **)&zstype) == SUCCESS) {
af9dc8
-			if (zend_hash_find(ht, "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS) {
af9dc8
+		if (zend_hash_find(ht, "enc_stype", sizeof("enc_stype"), (void **)&zstype) == SUCCESS &&
af9dc8
+		    Z_TYPE_PP(zstype) == IS_STRING) {
af9dc8
+			if (zend_hash_find(ht, "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS &&
af9dc8
+			    Z_TYPE_PP(zns) == IS_STRING) {
af9dc8
 				enc = get_encoder(SOAP_GLOBAL(sdl), Z_STRVAL_PP(zns), Z_STRVAL_PP(zstype));
af9dc8
 			} else {
af9dc8
 				zns = NULL;
af9dc8
@@ -445,8 +448,10 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
af9dc8
 		}
af9dc8
 
af9dc8
 		if (style == SOAP_ENCODED || (SOAP_GLOBAL(sdl) && encode != enc)) {
af9dc8
-			if (zend_hash_find(ht, "enc_stype", sizeof("enc_stype"), (void **)&zstype) == SUCCESS) {
af9dc8
-				if (zend_hash_find(ht, "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS) {
af9dc8
+			if (zend_hash_find(ht, "enc_stype", sizeof("enc_stype"), (void **)&zstype) == SUCCESS &&
af9dc8
+			    Z_TYPE_PP(zstype) == IS_STRING) {
af9dc8
+				if (zend_hash_find(ht, "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS &&
af9dc8
+				    Z_TYPE_PP(zns) == IS_STRING) {
af9dc8
 					set_ns_and_type_ex(node, Z_STRVAL_PP(zns), Z_STRVAL_PP(zstype));
af9dc8
 				} else {
af9dc8
 					set_ns_and_type_ex(node, NULL, Z_STRVAL_PP(zstype));
af9dc8
@@ -454,10 +459,12 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
af9dc8
 			}
af9dc8
 		}
af9dc8
 
af9dc8
-		if (zend_hash_find(ht, "enc_name", sizeof("enc_name"), (void **)&zname) == SUCCESS) {
af9dc8
+		if (zend_hash_find(ht, "enc_name", sizeof("enc_name"), (void **)&zname) == SUCCESS &&
af9dc8
+		    Z_TYPE_PP(zname) == IS_STRING) {
af9dc8
 			xmlNodeSetName(node, BAD_CAST(Z_STRVAL_PP(zname)));
af9dc8
 		}
af9dc8
-		if (zend_hash_find(ht, "enc_namens", sizeof("enc_namens"), (void **)&znamens) == SUCCESS) {
af9dc8
+		if (zend_hash_find(ht, "enc_namens", sizeof("enc_namens"), (void **)&znamens) == SUCCESS &&
af9dc8
+		    Z_TYPE_PP(zname) == IS_STRING) {
af9dc8
 			xmlNsPtr nsp = encode_add_ns(node, Z_STRVAL_PP(znamens));
af9dc8
 			xmlSetNs(node, nsp);
af9dc8
 		}
af9dc8
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
af9dc8
index 9ec6347..d460c17 100644
af9dc8
--- a/ext/soap/soap.c
af9dc8
+++ b/ext/soap/soap.c
af9dc8
@@ -3915,7 +3915,8 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
af9dc8
 		}
af9dc8
 
af9dc8
 		if (version == SOAP_1_1) {
af9dc8
-			if (zend_hash_find(prop, "faultcode", sizeof("faultcode"), (void**)&tmp) == SUCCESS) {
af9dc8
+			if (zend_hash_find(prop, "faultcode", sizeof("faultcode"), (void**)&tmp) == SUCCESS &&
af9dc8
+			    Z_TYPE_PP(tmp) == IS_STRING) {
af9dc8
 				size_t new_len;
af9dc8
 				xmlNodePtr node = xmlNewNode(NULL, BAD_CAST("faultcode"));
af9dc8
 				char *str = php_escape_html_entities((unsigned char*)Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &new_len, 0, 0, NULL TSRMLS_CC);
af9dc8
@@ -3940,7 +3941,8 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function
af9dc8
 			}
af9dc8
 			detail_name = "detail";
af9dc8
 		} else {
af9dc8
-			if (zend_hash_find(prop, "faultcode", sizeof("faultcode"), (void**)&tmp) == SUCCESS) {
af9dc8
+			if (zend_hash_find(prop, "faultcode", sizeof("faultcode"), (void**)&tmp) == SUCCESS &&
af9dc8
+			    Z_TYPE_PP(tmp) == IS_STRING) {
af9dc8
 				size_t new_len;
af9dc8
 				xmlNodePtr node = xmlNewChild(param, ns, BAD_CAST("Code"), NULL);
af9dc8
 				char *str = php_escape_html_entities((unsigned char*)Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &new_len, 0, 0, NULL TSRMLS_CC);
af9dc8
-- 
af9dc8
2.1.4
af9dc8
af9dc8
From 75f40ae1f3a7ca837d230f099627d121f9b3a32f Mon Sep 17 00:00:00 2001
af9dc8
From: Dmitry Stogov <dmitry@zend.com>
af9dc8
Date: Fri, 27 Mar 2015 18:40:58 +0300
af9dc8
Subject: [PATCH] Fixed bug #69293
af9dc8
af9dc8
---
af9dc8
 ext/soap/php_encoding.c | 2 +-
af9dc8
 1 file changed, 1 insertion(+), 1 deletion(-)
af9dc8
af9dc8
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
af9dc8
index 31f1f7c..13be2a5 100644
af9dc8
--- a/ext/soap/php_encoding.c
af9dc8
+++ b/ext/soap/php_encoding.c
af9dc8
@@ -464,7 +464,7 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
af9dc8
 			xmlNodeSetName(node, BAD_CAST(Z_STRVAL_PP(zname)));
af9dc8
 		}
af9dc8
 		if (zend_hash_find(ht, "enc_namens", sizeof("enc_namens"), (void **)&znamens) == SUCCESS &&
af9dc8
-		    Z_TYPE_PP(zname) == IS_STRING) {
af9dc8
+		    Z_TYPE_PP(znamens) == IS_STRING) {
af9dc8
 			xmlNsPtr nsp = encode_add_ns(node, Z_STRVAL_PP(znamens));
af9dc8
 			xmlSetNs(node, nsp);
af9dc8
 		}
af9dc8
-- 
af9dc8
2.1.4
af9dc8
af9dc8
From 997b7e56302710bb3db00b56d0629ac75d73a207 Mon Sep 17 00:00:00 2001
af9dc8
From: Xinchen Hui <laruence@php.net>
af9dc8
Date: Fri, 27 Feb 2015 23:32:32 +0800
af9dc8
Subject: [PATCH] Fixed bug #69085 (SoapClient's __call() type confusion
af9dc8
 through unserialize()).
af9dc8
af9dc8
---
af9dc8
 NEWS                              |  4 ++++
af9dc8
 ext/soap/soap.c                   |  6 +++---
af9dc8
 ext/soap/tests/bugs/bug69085.phpt | 17 +++++++++++++++++
af9dc8
 3 files changed, 24 insertions(+), 3 deletions(-)
af9dc8
 create mode 100644 ext/soap/tests/bugs/bug69085.phpt
af9dc8
af9dc8
diff --git a/ext/soap/tests/bugs/bug69085.phpt b/ext/soap/tests/bugs/bug69085.phpt
af9dc8
new file mode 100644
af9dc8
index 0000000..cb27cfd
af9dc8
--- /dev/null
af9dc8
+++ b/ext/soap/tests/bugs/bug69085.phpt
af9dc8
@@ -0,0 +1,17 @@
af9dc8
+--TEST--
af9dc8
+Bug #69085 (SoapClient's __call() type confusion through unserialize())
af9dc8
+--SKIPIF--
af9dc8
+
af9dc8
+--INI--
af9dc8
+soap.wsdl_cache_enabled=0
af9dc8
+--FILE--
af9dc8
+
af9dc8
+
af9dc8
+$dummy = unserialize('O:10:"SoapClient":5:{s:3:"uri";s:1:"a";s:8:"location";s:22:"http://localhost/a.xml";s:17:"__default_headers";i:1337;s:15:"__last_response";s:1:"a";s:5:"trace";s:1:"x";}');
af9dc8
+try {
af9dc8
+	$dummy->whatever();
af9dc8
+} catch (Exception $e) {
af9dc8
+	echo "okey";
af9dc8
+}
af9dc8
+--EXPECT--
af9dc8
+okey
af9dc8
-- 
af9dc8
2.1.4
af9dc8
af9dc8
From ff70b40dc978f3f4c457f72a71bb43fd17ee360b Mon Sep 17 00:00:00 2001
af9dc8
From: Remi Collet <remi@php.net>
af9dc8
Date: Mon, 13 Apr 2015 14:39:11 +0200
af9dc8
Subject: [PATCH] fix type in fix for #69085
af9dc8
af9dc8
---
af9dc8
 ext/soap/soap.c | 6 +++---
af9dc8
 1 file changed, 3 insertions(+), 3 deletions(-)
af9dc8
af9dc8
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
af9dc8
index 41aa1ad..1b8f545 100644
af9dc8
--- a/ext/soap/soap.c
af9dc8
+++ b/ext/soap/soap.c
af9dc8
@@ -2549,7 +2549,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
af9dc8
 	}
af9dc8
 
af9dc8
 	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
af9dc8
-	    (Z_LVAL_PP(trace) == IS_BOOL || Z_LVAL_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
af9dc8
+	    (Z_TYPE_PP(trace) == IS_BOOL || Z_TYPE_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
af9dc8
 		add_property_stringl(this_ptr, "__last_request", buf, buf_size, 1);
af9dc8
 	}
af9dc8
 
af9dc8
@@ -2589,7 +2589,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
af9dc8
 		}
af9dc8
 		ret = FALSE;
af9dc8
 	} else if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
af9dc8
-	           (Z_LVAL_PP(trace) == IS_BOOL || Z_LVAL_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
af9dc8
+	           (Z_TYPE_PP(trace) == IS_BOOL || Z_TYPE_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
af9dc8
 		add_property_stringl(this_ptr, "__last_response", Z_STRVAL_P(response), Z_STRLEN_P(response), 1);
af9dc8
 	}
af9dc8
 	xmlFree(buf);
af9dc8
@@ -2629,7 +2629,7 @@ static void do_soap_call(zval* this_ptr,
af9dc8
 	SOAP_CLIENT_BEGIN_CODE();
af9dc8
 
af9dc8
 	if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
af9dc8
-	    (Z_LVAL_PP(trace) == IS_BOOL || Z_LVAL_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
af9dc8
+	    (Z_TYPE_PP(trace) == IS_BOOL || Z_TYPE_PP(trace) == IS_LONG) && Z_LVAL_PP(trace) != 0) {
af9dc8
 		zend_hash_del(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request"));
af9dc8
 		zend_hash_del(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response"));
af9dc8
 	}
af9dc8
-- 
af9dc8
2.1.4
af9dc8