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