summaryrefslogtreecommitdiff
path: root/ext/soap
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2009-04-10 14:09:48 +0200
committerSean Finney <seanius@debian.org>2009-04-10 14:09:48 +0200
commitcd0b49c72aee33b3e44a9c589fcd93b9e1c7a64f (patch)
tree1315c623bb7d9dfa8d366fa9cd2c6834ceeb5da5 /ext/soap
parent9ea47aab740772adf0c69d8c94b208a464e599ea (diff)
downloadphp-upstream/5.2.9.dfsg.1.tar.gz
Imported Upstream version 5.2.9.dfsg.1upstream/5.2.9.dfsg.1
Diffstat (limited to 'ext/soap')
-rw-r--r--ext/soap/php_encoding.c121
-rw-r--r--ext/soap/php_encoding.h4
-rw-r--r--ext/soap/php_http.c10
-rw-r--r--ext/soap/php_http.h4
-rw-r--r--ext/soap/php_packet_soap.c4
-rw-r--r--ext/soap/php_packet_soap.h4
-rw-r--r--ext/soap/php_schema.c4
-rw-r--r--ext/soap/php_schema.h4
-rw-r--r--ext/soap/php_sdl.c15
-rw-r--r--ext/soap/php_sdl.h4
-rw-r--r--ext/soap/php_soap.h4
-rw-r--r--ext/soap/php_xml.c4
-rw-r--r--ext/soap/php_xml.h4
-rw-r--r--ext/soap/soap.c25
-rw-r--r--ext/soap/tests/bug46760.phpt16
-rw-r--r--ext/soap/tests/bugs/bug29109.phpt6
-rwxr-xr-xext/soap/tests/bugs/bug42151.phpt5
-rwxr-xr-xext/soap/tests/bugs/bug42214.phpt2
-rw-r--r--ext/soap/tests/bugs/bug43045.phpt52
-rw-r--r--ext/soap/tests/bugs/bug44811.phpt19
-rw-r--r--ext/soap/tests/bugs/bug44882.phpt64
-rw-r--r--ext/soap/tests/bugs/bug44882.wsdl75
-rw-r--r--ext/soap/tests/bugs/bug46419.phpt43
-rw-r--r--ext/soap/tests/bugs/bug46427.phpt20
-rw-r--r--ext/soap/tests/bugs/bug47049.phpt19
-rw-r--r--ext/soap/tests/bugs/bug47049.wsdl80
-rw-r--r--ext/soap/tests/bugs/multiport.phpt16
-rw-r--r--ext/soap/tests/bugs/multiport.wsdl88
28 files changed, 624 insertions, 92 deletions
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index eac079ac4..d39d1deb9 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_encoding.c,v 1.103.2.21.2.39 2007/12/31 07:20:11 sebastian Exp $ */
+/* $Id: php_encoding.c,v 1.103.2.21.2.46 2009/01/26 11:09:13 dmitry Exp $ */
#include <time.h>
@@ -360,6 +360,7 @@ static zend_bool soap_check_xml_ref(zval **data, xmlNodePtr node TSRMLS_DC)
static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xmlNodePtr parent, int check_class_map)
{
xmlNodePtr node = NULL;
+ int add_type = 0;
TSRMLS_FETCH();
/* Special handling of class SoapVar */
@@ -446,20 +447,21 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
zend_binary_strncasecmp(ce->name, ce->name_length, Z_STRVAL_PP(tmp), ce->name_length, ce->name_length) == 0 &&
zend_hash_get_current_key_ex(SOAP_GLOBAL(class_map), &type_name, &type_len, &idx, 0, &pos) == HASH_KEY_IS_STRING) {
- /* TODO: namespace isn't stored */
- encodePtr enc = NULL;
- if (SOAP_GLOBAL(sdl)) {
- enc = get_encoder(SOAP_GLOBAL(sdl), SOAP_GLOBAL(sdl)->target_ns, type_name);
- }
- if (enc) {
- encode = enc;
- } else if (SOAP_GLOBAL(sdl)) {
- enc = find_encoder_by_type_name(SOAP_GLOBAL(sdl), type_name);
- if (enc) {
- encode = enc;
- }
- }
- break;
+ /* TODO: namespace isn't stored */
+ encodePtr enc = NULL;
+ if (SOAP_GLOBAL(sdl)) {
+ enc = get_encoder(SOAP_GLOBAL(sdl), SOAP_GLOBAL(sdl)->target_ns, type_name);
+ if (!enc) {
+ enc = find_encoder_by_type_name(SOAP_GLOBAL(sdl), type_name);
+ }
+ }
+ if (enc) {
+ if (encode != enc && style == SOAP_LITERAL) {
+ add_type = 1;
+ }
+ encode = enc;
+ }
+ break;
}
}
}
@@ -484,6 +486,9 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
}
if (encode->to_xml) {
node = encode->to_xml(&encode->details, data, style, parent);
+ if (add_type) {
+ set_ns_and_type(node, &encode->details);
+ }
}
}
return node;
@@ -1014,7 +1019,15 @@ static zval *to_zval_double(encodeTypePtr type, xmlNodePtr data)
Z_DVAL_P(ret) = dval;
break;
default:
- soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
+ if (strncasecmp((char*)data->children->content, "NaN", sizeof("NaN")-1) == 0) {
+ ZVAL_DOUBLE(ret, php_get_nan());
+ } else if (strncasecmp((char*)data->children->content, "INF", sizeof("INF")-1) == 0) {
+ ZVAL_DOUBLE(ret, php_get_inf());
+ } else if (strncasecmp((char*)data->children->content, "-INF", sizeof("-INF")-1) == 0) {
+ ZVAL_DOUBLE(ret, -php_get_inf());
+ } else {
+ soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
+ }
}
} else {
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
@@ -1406,7 +1419,7 @@ static zval *to_zval_object_ex(encodeTypePtr type, xmlNodePtr data, zend_class_e
sdlPtr sdl;
sdlTypePtr sdlType = type->sdl_type;
zend_class_entry *ce = ZEND_STANDARD_CLASS_DEF_PTR;
- zend_bool redo_any = 0;
+ zval *redo_any = NULL;
TSRMLS_FETCH();
if (pce) {
@@ -1478,10 +1491,7 @@ static zval *to_zval_object_ex(encodeTypePtr type, xmlNodePtr data, zend_class_e
if (soap_check_xml_ref(&ret, data TSRMLS_CC)) {
return ret;
}
- if (get_zval_property(ret, "any" TSRMLS_CC) != NULL) {
- unset_zval_property(ret, "any" TSRMLS_CC);
- redo_any = 1;
- }
+ redo_any = get_zval_property(ret, "any" TSRMLS_CC);
if (Z_TYPE_P(ret) == IS_OBJECT && ce != ZEND_STANDARD_CLASS_DEF_PTR) {
zend_object *zobj = zend_objects_get_address(ret TSRMLS_CC);
zobj->ce = ce;
@@ -1507,10 +1517,17 @@ static zval *to_zval_object_ex(encodeTypePtr type, xmlNodePtr data, zend_class_e
object_init_ex(ret, ce);
}
if (sdlType->model) {
+ if (redo_any) {
+ redo_any->refcount++;
+ unset_zval_property(ret, "any" TSRMLS_CC);
+ }
model_to_zval_object(ret, sdlType->model, data, sdl TSRMLS_CC);
- if (redo_any && get_zval_property(ret, "any" TSRMLS_CC) == NULL) {
- model_to_zval_any(ret, data->children TSRMLS_CC);
- }
+ if (redo_any) {
+ if (get_zval_property(ret, "any" TSRMLS_CC) == NULL) {
+ model_to_zval_any(ret, data->children TSRMLS_CC);
+ }
+ zval_ptr_dtor(&redo_any);
+ }
}
if (sdlType->attributes) {
sdlAttributePtr *attr;
@@ -1615,6 +1632,13 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval *
encodePtr enc;
data = get_zval_property(object, model->u.element->name TSRMLS_CC);
+ if (data &&
+ Z_TYPE_P(data) == IS_NULL &&
+ !model->u.element->nillable &&
+ model->min_occurs > 0 &&
+ !strict) {
+ return 0;
+ }
if (data) {
enc = model->u.element->encode;
if ((model->max_occurs == -1 || model->max_occurs > 1) &&
@@ -2638,33 +2662,32 @@ static xmlNodePtr to_xml_map(encodeTypePtr type, zval *data, int style, xmlNodeP
ulong int_val;
zend_hash_get_current_data(data->value.ht, (void **)&temp_data);
- if (Z_TYPE_PP(temp_data) != IS_NULL) {
- item = xmlNewNode(NULL, BAD_CAST("item"));
- xmlAddChild(xmlParam, item);
- key = xmlNewNode(NULL, BAD_CAST("key"));
- xmlAddChild(item,key);
- if (zend_hash_get_current_key(data->value.ht, &key_val, &int_val, FALSE) == HASH_KEY_IS_STRING) {
- if (style == SOAP_ENCODED) {
- set_xsi_type(key, "xsd:string");
- }
- xmlNodeSetContent(key, BAD_CAST(key_val));
- } else {
- smart_str tmp = {0};
- smart_str_append_long(&tmp, int_val);
- smart_str_0(&tmp);
-
- if (style == SOAP_ENCODED) {
- set_xsi_type(key, "xsd:int");
- }
- xmlNodeSetContentLen(key, BAD_CAST(tmp.c), tmp.len);
-
- smart_str_free(&tmp);
+ item = xmlNewNode(NULL, BAD_CAST("item"));
+ xmlAddChild(xmlParam, item);
+ key = xmlNewNode(NULL, BAD_CAST("key"));
+ xmlAddChild(item,key);
+ if (zend_hash_get_current_key(data->value.ht, &key_val, &int_val, FALSE) == HASH_KEY_IS_STRING) {
+ if (style == SOAP_ENCODED) {
+ set_xsi_type(key, "xsd:string");
}
+ xmlNodeSetContent(key, BAD_CAST(key_val));
+ } else {
+ smart_str tmp = {0};
+ smart_str_append_long(&tmp, int_val);
+ smart_str_0(&tmp);
- xparam = master_to_xml(get_conversion((*temp_data)->type), (*temp_data), style, item);
+ if (style == SOAP_ENCODED) {
+ set_xsi_type(key, "xsd:int");
+ }
+ xmlNodeSetContentLen(key, BAD_CAST(tmp.c), tmp.len);
- xmlNodeSetName(xparam, BAD_CAST("value"));
+ smart_str_free(&tmp);
}
+
+ xparam = master_to_xml(get_conversion((*temp_data)->type), (*temp_data), style, item);
+
+ xmlNodeSetName(xparam, BAD_CAST("value"));
+
zend_hash_move_forward(data->value.ht);
}
}
@@ -2856,7 +2879,7 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma
#ifdef HAVE_TM_GMTOFF
snprintf(tzbuf, sizeof(tzbuf), "%c%02d:%02d", (ta->tm_gmtoff < 0) ? '-' : '+', abs(ta->tm_gmtoff / 3600), abs( (ta->tm_gmtoff % 3600) / 60 ));
#else
-# ifdef __CYGWIN__
+# if defined(__CYGWIN__) || defined(NETWARE)
snprintf(tzbuf, sizeof(tzbuf), "%c%02d:%02d", ((ta->tm_isdst ? _timezone - 3600:_timezone)>0)?'-':'+', abs((ta->tm_isdst ? _timezone - 3600 : _timezone) / 3600), abs(((ta->tm_isdst ? _timezone - 3600 : _timezone) % 3600) / 60));
# else
snprintf(tzbuf, sizeof(tzbuf), "%c%02d:%02d", ((ta->tm_isdst ? timezone - 3600:timezone)>0)?'-':'+', abs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600), abs(((ta->tm_isdst ? timezone - 3600 : timezone) % 3600) / 60));
diff --git a/ext/soap/php_encoding.h b/ext/soap/php_encoding.h
index 48ae6992d..56f02a9bf 100644
--- a/ext/soap/php_encoding.h
+++ b/ext/soap/php_encoding.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_encoding.h,v 1.38.2.3.2.5 2007/12/31 07:20:11 sebastian Exp $ */
+/* $Id: php_encoding.h,v 1.38.2.3.2.6 2008/12/31 11:17:43 sebastian Exp $ */
#ifndef PHP_ENCODING_H
#define PHP_ENCODING_H
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 19aaa53a5..4fe7dfc9d 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_http.c,v 1.77.2.11.2.15 2008/04/08 14:11:49 jorton Exp $ */
+/* $Id: php_http.c,v 1.77.2.11.2.17 2009/01/19 21:57:45 iliaa Exp $ */
#include "php_soap.h"
#include "ext/standard/base64.h"
@@ -438,7 +438,11 @@ try_again:
smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
smart_str_append_const(&soap_headers, "\r\n");
}
- } else{
+ } else if (FG(user_agent)) {
+ smart_str_append_const(&soap_headers, "User-Agent: ");
+ smart_str_appends(&soap_headers, FG(user_agent));
+ smart_str_append_const(&soap_headers, "\r\n");
+ } else {
smart_str_append_const(&soap_headers, "User-Agent: PHP-SOAP/"PHP_VERSION"\r\n");
}
diff --git a/ext/soap/php_http.h b/ext/soap/php_http.h
index 5dec5a344..536a10bb8 100644
--- a/ext/soap/php_http.h
+++ b/ext/soap/php_http.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_http.h,v 1.16.2.1.2.2 2007/12/31 07:20:11 sebastian Exp $ */
+/* $Id: php_http.h,v 1.16.2.1.2.3 2008/12/31 11:17:43 sebastian Exp $ */
#ifndef PHP_HTTP_H
#define PHP_HTTP_H
diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c
index 18e9698c4..d2883e61c 100644
--- a/ext/soap/php_packet_soap.c
+++ b/ext/soap/php_packet_soap.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_packet_soap.c,v 1.42.2.1.2.5 2007/12/31 07:20:11 sebastian Exp $ */
+/* $Id: php_packet_soap.c,v 1.42.2.1.2.6 2008/12/31 11:17:43 sebastian Exp $ */
#include "php_soap.h"
diff --git a/ext/soap/php_packet_soap.h b/ext/soap/php_packet_soap.h
index 2a9712eb2..f358aa978 100644
--- a/ext/soap/php_packet_soap.h
+++ b/ext/soap/php_packet_soap.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_packet_soap.h,v 1.10.2.1.2.2 2007/12/31 07:20:11 sebastian Exp $ */
+/* $Id: php_packet_soap.h,v 1.10.2.1.2.3 2008/12/31 11:17:43 sebastian Exp $ */
#ifndef PHP_PACKET_SOAP_H
#define PHP_PACKET_SOAP_H
diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c
index 55bc9e66b..8b4f8c992 100644
--- a/ext/soap/php_schema.c
+++ b/ext/soap/php_schema.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_schema.c,v 1.58.2.6.2.7 2007/12/31 07:20:11 sebastian Exp $ */
+/* $Id: php_schema.c,v 1.58.2.6.2.8 2008/12/31 11:17:43 sebastian Exp $ */
#include "php_soap.h"
#include "libxml/uri.h"
diff --git a/ext/soap/php_schema.h b/ext/soap/php_schema.h
index 17cab24c7..32198959e 100644
--- a/ext/soap/php_schema.h
+++ b/ext/soap/php_schema.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_schema.h,v 1.13.2.2.2.2 2007/12/31 07:20:11 sebastian Exp $ */
+/* $Id: php_schema.h,v 1.13.2.2.2.3 2008/12/31 11:17:43 sebastian Exp $ */
#ifndef PHP_SCHEMA_H
#define PHP_SCHEMA_H
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index 8e2475898..78ef3ddf2 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_sdl.c,v 1.88.2.12.2.10 2007/12/31 07:20:11 sebastian Exp $ */
+/* $Id: php_sdl.c,v 1.88.2.12.2.13 2008/12/31 11:17:43 sebastian Exp $ */
#include "php_soap.h"
#include "ext/libxml/php_libxml.h"
@@ -240,7 +240,12 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include
wsdl = soap_xmlParseFile(struri TSRMLS_CC);
if (!wsdl) {
- soap_error1(E_ERROR, "Parsing WSDL: Couldn't load from '%s'", struri);
+ xmlErrorPtr xmlErrorPtr = xmlGetLastError();
+ if (xmlErrorPtr) {
+ soap_error2(E_ERROR, "Parsing WSDL: Couldn't load from '%s' : %s", struri, xmlErrorPtr->message);
+ } else {
+ soap_error1(E_ERROR, "Parsing WSDL: Couldn't load from '%s'", struri);
+ }
}
zend_hash_add(&ctx->docs, struri, strlen(struri)+1, (void**)&wsdl, sizeof(xmlDocPtr), NULL);
@@ -716,12 +721,12 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri TSRMLS_DC)
}
trav2 = trav2->next;
}
- if (!address) {
+ if (!address || tmpbinding->bindingType == BINDING_HTTP) {
if (has_soap_port || trav->next || i < n-1) {
efree(tmpbinding);
trav = trav->next;
continue;
- } else {
+ } else if (!address) {
soap_error0(E_ERROR, "Parsing WSDL: No address associated with <port>");
}
}
diff --git a/ext/soap/php_sdl.h b/ext/soap/php_sdl.h
index 8a9eb7c57..cd7627a6c 100644
--- a/ext/soap/php_sdl.h
+++ b/ext/soap/php_sdl.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_sdl.h,v 1.37.2.3.2.3 2007/12/31 07:20:11 sebastian Exp $ */
+/* $Id: php_sdl.h,v 1.37.2.3.2.4 2008/12/31 11:17:43 sebastian Exp $ */
#ifndef PHP_SDL_H
#define PHP_SDL_H
diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h
index 95758a612..0b219439c 100644
--- a/ext/soap/php_soap.h
+++ b/ext/soap/php_soap.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_soap.h,v 1.38.2.6.2.8 2008/01/09 16:45:28 dmitry Exp $ */
+/* $Id: php_soap.h,v 1.38.2.6.2.9 2008/12/31 11:17:43 sebastian Exp $ */
#ifndef PHP_SOAP_H
#define PHP_SOAP_H
diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c
index 4da4738f0..e2f5a984b 100644
--- a/ext/soap/php_xml.c
+++ b/ext/soap/php_xml.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_xml.c,v 1.25.2.1.2.3 2007/12/31 07:20:11 sebastian Exp $ */
+/* $Id: php_xml.c,v 1.25.2.1.2.4 2008/12/31 11:17:43 sebastian Exp $ */
#include "php_soap.h"
#include "libxml/parser.h"
diff --git a/ext/soap/php_xml.h b/ext/soap/php_xml.h
index 24e4480c4..d56e0027a 100644
--- a/ext/soap/php_xml.h
+++ b/ext/soap/php_xml.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_xml.h,v 1.17.2.1.2.3 2007/12/31 07:20:11 sebastian Exp $ */
+/* $Id: php_xml.h,v 1.17.2.1.2.4 2008/12/31 11:17:43 sebastian Exp $ */
#ifndef PHP_SOAP_XML_H
#define PHP_SOAP_XML_H
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index a20c7860e..8a9e9bafe 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 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 |
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: soap.c,v 1.156.2.28.2.39 2008/03/04 12:23:10 dmitry Exp $ */
+/* $Id: soap.c,v 1.156.2.28.2.44 2009/02/18 13:25:32 dmitry Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -2348,6 +2348,7 @@ PHP_METHOD(SoapClient, SoapClient)
if (zend_hash_find(ht, "stream_context", sizeof("stream_context"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_RESOURCE) {
context = php_stream_context_from_zval(*tmp, 1);
+ zend_list_addref(context->rsrc_id);
}
if (zend_hash_find(ht, "location", sizeof("location"), (void**)&tmp) == SUCCESS &&
@@ -2380,8 +2381,8 @@ PHP_METHOD(SoapClient, SoapClient)
if (zend_hash_find(ht, "proxy_host", sizeof("proxy_host"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, "_proxy_host", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
- if (zend_hash_find(ht, "proxy_port", sizeof("proxy_port"), (void**)&tmp) == SUCCESS &&
- Z_TYPE_PP(tmp) == IS_LONG) {
+ if (zend_hash_find(ht, "proxy_port", sizeof("proxy_port"), (void**)&tmp) == SUCCESS) {
+ convert_to_long(*tmp);
add_property_long(this_ptr, "_proxy_port", Z_LVAL_PP(tmp));
}
if (zend_hash_find(ht, "proxy_login", sizeof("proxy_login"), (void**)&tmp) == SUCCESS &&
@@ -2566,11 +2567,11 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
ZVAL_LONG(params[4], one_way);
if (call_user_function(NULL, &this_ptr, &func, response, 5, params TSRMLS_CC) != SUCCESS) {
- add_soap_fault(this_ptr, "Client", "SoapSlient::__doRequest() failed", NULL, NULL TSRMLS_CC);
+ add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() failed", NULL, NULL TSRMLS_CC);
ret = FALSE;
} else if (Z_TYPE_P(response) != IS_STRING) {
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault"), (void **) &fault) == FAILURE) {
- add_soap_fault(this_ptr, "Client", "SoapSlient::__doRequest() returned non string value", NULL, NULL TSRMLS_CC);
+ add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() returned non string value", NULL, NULL TSRMLS_CC);
}
ret = FALSE;
} else if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
@@ -4186,7 +4187,17 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function
/*style = SOAP_RPC;*/
if (style == SOAP_RPC) {
ns = encode_add_ns(body, uri);
- method = xmlNewChild(body, ns, BAD_CAST(function_name), NULL);
+ if (function_name) {
+ method = xmlNewChild(body, ns, BAD_CAST(function_name), NULL);
+ } else if (function && function->requestName) {
+ method = xmlNewChild(body, ns, BAD_CAST(function->requestName), NULL);
+ } else if (function && function->functionName) {
+ method = xmlNewChild(body, ns, BAD_CAST(function->functionName), NULL);
+ } else {
+ method = body;
+ }
+ } else {
+ method = body;
}
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "use", sizeof("use"), (void **)&zuse) == SUCCESS &&
diff --git a/ext/soap/tests/bug46760.phpt b/ext/soap/tests/bug46760.phpt
new file mode 100644
index 000000000..0b7c9ab4c
--- /dev/null
+++ b/ext/soap/tests/bug46760.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #46760 (SoapClient doRequest fails when proxy is used)
+--FILE--
+<?php
+
+$client = new SoapClient(null, array('proxy_host' => "localhost",
+ 'proxy_port' => '8080',
+ 'login' => "user",
+ 'password' => "test",
+ 'uri' => 'mo:http://www.w3.org/',
+ 'location' => 'http://some.url'));
+var_dump($client->_proxy_port);
+
+?>
+--EXPECT--
+int(8080)
diff --git a/ext/soap/tests/bugs/bug29109.phpt b/ext/soap/tests/bugs/bug29109.phpt
index a69674ece..f998a1ba2 100644
--- a/ext/soap/tests/bugs/bug29109.phpt
+++ b/ext/soap/tests/bugs/bug29109.phpt
@@ -10,11 +10,7 @@ $client = new SoapClient(dirname(__FILE__)."/bug29109.wsdl");
var_dump($client->__getFunctions());
?>
--EXPECT--
-array(3) {
+array(1) {
[0]=>
string(53) "HelloWorldResponse HelloWorld(HelloWorld $parameters)"
- [1]=>
- string(19) "string HelloWorld()"
- [2]=>
- string(19) "string HelloWorld()"
} \ No newline at end of file
diff --git a/ext/soap/tests/bugs/bug42151.phpt b/ext/soap/tests/bugs/bug42151.phpt
index 7f7a87bd1..ee53e6d52 100755
--- a/ext/soap/tests/bugs/bug42151.phpt
+++ b/ext/soap/tests/bugs/bug42151.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #42151 __destruct functions not called after catching a SoapFault exception
+Bug #42151 (__destruct functions not called after catching a SoapFault exception)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
@@ -26,6 +26,7 @@ try {
echo "ok\n";
?>
--EXPECT--
-SOAP-ERROR: Parsing WSDL: Couldn't load from 'httpx://'
+SOAP-ERROR: Parsing WSDL: Couldn't load from 'httpx://' : failed to load external entity "httpx://"
+
ok
I don't get executed either.
diff --git a/ext/soap/tests/bugs/bug42214.phpt b/ext/soap/tests/bugs/bug42214.phpt
index aaad3a14f..216d7895b 100755
--- a/ext/soap/tests/bugs/bug42214.phpt
+++ b/ext/soap/tests/bugs/bug42214.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #42214 SoapServer sends clients internal PHP errors
+Bug #42214 (SoapServer sends clients internal PHP errors)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/soap/tests/bugs/bug43045.phpt b/ext/soap/tests/bugs/bug43045.phpt
new file mode 100644
index 000000000..a32acfe0e
--- /dev/null
+++ b/ext/soap/tests/bugs/bug43045.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Bug #43045i (SOAP encoding violation on "INF" for type double/float)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function test($x) {
+ return $x;
+}
+
+class TestSoapClient extends SoapClient {
+ function __construct($wsdl, $options) {
+ parent::__construct($wsdl, $options);
+ $this->server = new SoapServer($wsdl, $options);
+ $this->server->addFunction('test');
+ }
+ function __doRequest($request, $location, $action, $version, $one_way = 0) {
+ ob_start();
+ $this->server->handle($request);
+ $response = ob_get_contents();
+ ob_end_clean();
+ return $response;
+
+ echo $request;
+ return '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+<soap:Body><testResponse xmlns="urn:TestSOAP">
+<s-gensym3>
+<doubleInfinity xsi:type="xsd:double">INF</doubleInfinity>
+</s-gensym3>
+</testResponse>
+</soap:Body></soap:Envelope>';
+ }
+}
+$client = new TestSoapClient(NULL, array(
+ "location" => "test://",
+ "uri" => 'urn:TestSOAP',
+ "style" => SOAP_RPC,
+ "use" => SOAP_ENCODED
+ ));
+var_dump($client->test(0.1));
+var_dump($client->test(NAN));
+var_dump($response = $client->test(INF));
+var_dump($response = $client->test(-INF));
+--EXPECT--
+float(0.1)
+float(NAN)
+float(INF)
+float(-INF)
diff --git a/ext/soap/tests/bugs/bug44811.phpt b/ext/soap/tests/bugs/bug44811.phpt
new file mode 100644
index 000000000..b2e1fc4f6
--- /dev/null
+++ b/ext/soap/tests/bugs/bug44811.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #44811 (Improve error messages when creating new SoapClient which contains invalid data)
+--SKIPIF--
+<?php require_once 'skipif.inc'; ?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+try {
+ $x = new SoapClient('http://slashdot.org');
+} catch (SoapFault $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+die('ok');
+?>
+--EXPECT--
+SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://slashdot.org' : Premature end of data in tag html line 3
+
+ok
diff --git a/ext/soap/tests/bugs/bug44882.phpt b/ext/soap/tests/bugs/bug44882.phpt
new file mode 100644
index 000000000..baad74784
--- /dev/null
+++ b/ext/soap/tests/bugs/bug44882.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Bug #44882 (SOAP extension object decoding bug)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+class TestSoapClient extends SoapClient
+{
+ public function __doRequest($req, $loc, $act, $ver, $oneway)
+ {
+ return <<<XML
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope
+ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ns="urn:ebay:api:PayPalAPI">
+ <SOAP-ENV:Body id="_0">
+ <GetExpressCheckoutDetailsResponse xmlns="urn:ebay:api:PayPalAPI">
+ <Timestamp>2008-06-23T14:51:08Z</Timestamp>
+ <Ack>Success</Ack>
+ <CorrelationID>ae013a0ccdf13</CorrelationID>
+ <Version>50.000000</Version>
+ <Build>588340</Build>
+ <GetExpressCheckoutDetailsResponseDetails xsi:type="ns:GetExpressCheckoutDetailsResponseDetailsType">
+ <Token>EC-11Y75137T2399952C</Token>
+ <PayerInfo>
+ <Payer>example@example.com</Payer>
+ <PayerID>MU82WA43YXM9C</PayerID>
+ <PayerStatus>verified</PayerStatus>
+ </PayerInfo>
+ </GetExpressCheckoutDetailsResponseDetails>
+ </GetExpressCheckoutDetailsResponse>
+ </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
+XML;
+ }
+}
+
+$client = new TestSoapClient(dirname(__FILE__).'/bug44882.wsdl');
+print_r($client->GetExpressCheckoutDetails());
+?>
+--EXPECT--
+stdClass Object
+(
+ [Timestamp] => 2008-06-23T14:51:08Z
+ [Ack] => Success
+ [CorrelationID] => ae013a0ccdf13
+ [Version] => 50.000000
+ [Build] => 588340
+ [GetExpressCheckoutDetailsResponseDetails] => stdClass Object
+ (
+ [Token] => EC-11Y75137T2399952C
+ [PayerInfo] => stdClass Object
+ (
+ [Payer] => example@example.com
+ [PayerID] => MU82WA43YXM9C
+ [PayerStatus] => verified
+ )
+
+ )
+
+)
diff --git a/ext/soap/tests/bugs/bug44882.wsdl b/ext/soap/tests/bugs/bug44882.wsdl
new file mode 100644
index 000000000..266f6a05b
--- /dev/null
+++ b/ext/soap/tests/bugs/bug44882.wsdl
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns="urn:ebay:api:PayPalAPI"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ targetNamespace="urn:ebay:api:PayPalAPI">
+ <wsdl:types>
+ <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:ebay:api:PayPalAPI" elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <complexType name="PayerInfoType">
+ <sequence>
+ <element name="Payer" type="xs:string" minOccurs="0"/>
+ <element name="PayerID" type="xs:string" minOccurs="0"/>
+ <element name="PayerStatus" type="xs:string" minOccurs="0"/>
+ </sequence>
+ </complexType>
+ <complexType name="AbstractResponseType" abstract="true">
+ <sequence>
+ <element name="Timestamp" type="xs:dateTime" minOccurs="0"/>
+ <element name="Ack" type="xs:string"/>
+ <element name="CorrelationID" type="xs:string" minOccurs="0"/>
+ <element name="Version" type="xs:string"/>
+ <element name="Build" type="xs:string"/>
+ <any processContents="lax" minOccurs="0"/>
+ </sequence>
+ </complexType>
+ <xs:element name="GetExpressCheckoutDetailsResponseDetails" type="ns:GetExpressCheckoutDetailsResponseDetailsType"/>
+ <xs:complexType name="GetExpressCheckoutDetailsResponseDetailsType">
+ <xs:sequence>
+ <xs:element name="Token" type="xs:string"/>
+ <xs:element name="PayerInfo" type="ns:PayerInfoType"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="GetExpressCheckoutDetailsResponse" type="ns:GetExpressCheckoutDetailsResponseType"/>
+ <xs:complexType name="GetExpressCheckoutDetailsResponseType">
+ <xs:complexContent>
+ <xs:extension base="ns:AbstractResponseType">
+ <xs:sequence>
+ <xs:element ref="ns:GetExpressCheckoutDetailsResponseDetails" minOccurs="1" maxOccurs="1"/>
+ </xs:sequence>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </schema>
+ </wsdl:types>
+ <wsdl:message name="GetExpressCheckoutDetailsRequest">
+ </wsdl:message>
+ <wsdl:message name="GetExpressCheckoutDetailsResponse">
+ <wsdl:part name="GetExpressCheckoutDetailsResponse" element="ns:GetExpressCheckoutDetailsResponse"/>
+ </wsdl:message>
+ <wsdl:portType name="PayPalAPIAAInterface">
+ <wsdl:operation name="GetExpressCheckoutDetails">
+ <wsdl:input message="ns:GetExpressCheckoutDetailsRequest"/>
+ <wsdl:output message="ns:GetExpressCheckoutDetailsResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="PayPalAPIAASoapBinding" type="ns:PayPalAPIAAInterface">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="GetExpressCheckoutDetails">
+ <wsdlsoap:operation/>
+ <wsdl:input>
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="PayPalAPIInterfaceService">
+ <wsdl:port name="PayPalAPIAA" binding="ns:PayPalAPIAASoapBinding">
+ <wsdlsoap:address location="test://"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/ext/soap/tests/bugs/bug46419.phpt b/ext/soap/tests/bugs/bug46419.phpt
new file mode 100644
index 000000000..cb113e28d
--- /dev/null
+++ b/ext/soap/tests/bugs/bug46419.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Bug #46419 (Elements of associative arrays with NULL value are lost)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function bar() {
+ return array('a' => 1, 'b' => NULL, 'c' => 2, 'd'=>'');
+}
+
+class LocalSoapClient extends SoapClient {
+
+ function __construct($wsdl, $options) {
+ parent::__construct($wsdl, $options);
+ $this->server = new SoapServer($wsdl, $options);
+ $this->server->addFunction('bar');
+ }
+
+ function __doRequest($request, $location, $action, $version, $one_way = 0) {
+ ob_start();
+ $this->server->handle($request);
+ $response = ob_get_contents();
+ ob_end_clean();
+ return $response;
+ }
+
+}
+
+$x = new LocalSoapClient(NULL,array('location'=>'test://',
+ 'uri'=>'http://testuri.org'));
+var_dump($x->bar());
+?>
+--EXPECT--
+array(4) {
+ ["a"]=>
+ int(1)
+ ["b"]=>
+ NULL
+ ["c"]=>
+ int(2)
+ ["d"]=>
+ string(0) ""
+}
diff --git a/ext/soap/tests/bugs/bug46427.phpt b/ext/soap/tests/bugs/bug46427.phpt
new file mode 100644
index 000000000..5cf2e8f96
--- /dev/null
+++ b/ext/soap/tests/bugs/bug46427.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #46427 (SoapClient() stumbles over its "stream_context" parameter)
+--FILE--
+<?php
+error_reporting(E_ALL|E_STRICT);
+
+function getSoapClient_1() {
+ $ctx = stream_context_create();
+ return new SoapClient(NULL, array(
+ 'stream_context' => $ctx,
+ 'location' => 'test://',
+ 'uri' => 'test://',
+ 'exceptions' => false));
+}
+
+getSoapClient_1()->__soapCall('Help', array());
+echo "ok\n";
+?>
+--EXPECT--
+ok
diff --git a/ext/soap/tests/bugs/bug47049.phpt b/ext/soap/tests/bugs/bug47049.phpt
new file mode 100644
index 000000000..bdc16274e
--- /dev/null
+++ b/ext/soap/tests/bugs/bug47049.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #47049 (SoapClient::__soapCall causes a segmentation fault)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+$client = new SoapClient(dirname(__FILE__) . '/bug47049.wsdl',
+ array('trace' => 1 , 'exceptions' => 0));
+$host = array('uuid' => 'foo');
+$software_list = array(array('name' => 'package', 'version' => '1.2.3', 'state' => 'installed'));
+$updates = array();
+$report_id = $client->__soapCall('reportSoftwareStatus',array($host, $software_list, $updates));
+echo $client->__getLastRequest();
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.example.org/reporter/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:reportSoftwareStatus><host xsi:type="ns1:host"><uuid xsi:type="xsd:string">foo</uuid></host><software_list xsi:type="ns1:software_list"><software xsi:type="ns1:software"><name xsi:type="xsd:string">package</name><version xsi:type="xsd:string">1.2.3</version><state xsi:type="xsd:string">installed</state></software></software_list><updates xsi:type="ns1:updates"/></ns1:reportSoftwareStatus></SOAP-ENV:Body></SOAP-ENV:Envelope>
diff --git a/ext/soap/tests/bugs/bug47049.wsdl b/ext/soap/tests/bugs/bug47049.wsdl
new file mode 100644
index 000000000..b5730a38e
--- /dev/null
+++ b/ext/soap/tests/bugs/bug47049.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.example.org/reporter/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="reporter" targetNamespace="http://www.example.org/reporter/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+ <wsdl:types><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/reporter/">
+ <xsd:complexType name="host">
+ <xsd:sequence>
+ <xsd:element name="uuid" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="software_list">
+ <xsd:sequence>
+ <xsd:element name="software" type="tns:software"
+ maxOccurs="unbounded" minOccurs="1">
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="software">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" maxOccurs="1" minOccurs="1"></xsd:element>
+ <xsd:element name="version" type="xsd:string" maxOccurs="1" minOccurs="1"></xsd:element>
+ <xsd:element name="state" type="xsd:string" maxOccurs="1" minOccurs="1"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="updates">
+ <xsd:sequence>
+ <xsd:element name="update" type="tns:update"
+ maxOccurs="unbounded" minOccurs="0">
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="update">
+ <xsd:sequence>
+ <xsd:element name="software" type="xsd:string"></xsd:element>
+ <xsd:element name="old_version" type="xsd:string"></xsd:element>
+ <xsd:element name="new_version" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema></wsdl:types>
+ <wsdl:message name="reportSoftwareStatusRequest">
+ <wsdl:part name="host" type="tns:host"/>
+ <wsdl:part name="software_list" type="tns:software_list"></wsdl:part>
+ <wsdl:part name="updates" type="tns:updates"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="reportSoftwareStatusResponse">
+ <wsdl:part name="report_id" type="xsd:int"/>
+ </wsdl:message>
+ <wsdl:portType name="reporter">
+ <wsdl:operation name="reportSoftwareStatus">
+ <wsdl:input message="tns:reportSoftwareStatusRequest"/>
+ <wsdl:output message="tns:reportSoftwareStatusResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="reporterHTTP" type="tns:reporter">
+
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="reportSoftwareStatus">
+
+ <soap:operation
+ soapAction="http://www.example.org/reporter/reportSoftwareStatus" />
+ <wsdl:input>
+
+
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+
+
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="reporter">
+ <wsdl:port binding="tns:reporterHTTP" name="reporterHTTP">
+ <http:address location="test://"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/ext/soap/tests/bugs/multiport.phpt b/ext/soap/tests/bugs/multiport.phpt
new file mode 100644
index 000000000..0b5e94451
--- /dev/null
+++ b/ext/soap/tests/bugs/multiport.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Proper binding selection
+--SKIPIF--
+<?php require_once 'skipif.inc'; ?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+$client = new SoapClient(dirname(__FILE__).'/multiport.wsdl',
+ array('trace' => true, 'exceptions' => false));
+$response = $client->GetSessionId(array('userId'=>'user', 'password'=>'password'));
+echo $client->__getLastRequest();
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.reuters.com/"><SOAP-ENV:Body><ns1:GetSessionId><ns1:userId>user</ns1:userId><ns1:password>password</ns1:password></ns1:GetSessionId></SOAP-ENV:Body></SOAP-ENV:Envelope>
diff --git a/ext/soap/tests/bugs/multiport.wsdl b/ext/soap/tests/bugs/multiport.wsdl
new file mode 100644
index 000000000..604e963d8
--- /dev/null
+++ b/ext/soap/tests/bugs/multiport.wsdl
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions targetNamespace="http://www.reuters.com/" xmlns:tns="http://www.reuters.com/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:s="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+ <s:schema elementFormDefault="qualified" targetNamespace="http://www.reuters.com/">
+ <s:element name="GetSessionId">
+ <s:complexType>
+ <s:sequence>
+ <s:element maxOccurs="1" minOccurs="0" name="userId" type="s:string"/>
+ <s:element maxOccurs="1" minOccurs="0" name="password" type="s:string"/>
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ <s:element name="GetSessionIdResponse">
+ <s:complexType>
+ <s:sequence>
+ <s:element maxOccurs="1" minOccurs="0" name="GetSessionIdResult" type="s:string"/>
+ </s:sequence>
+ </s:complexType>
+ </s:element>
+ </s:schema>
+ </wsdl:types>
+ <wsdl:message name="GetSessionIdHttpGetIn">
+ <wsdl:part name="userId" type="s:string">
+ </wsdl:part>
+ <wsdl:part name="password" type="s:string">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="GetSessionIdHttpGetOut">
+ <wsdl:part name="Body" element="tns:string">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="GetSessionIdSoapOut">
+ <wsdl:part name="parameters" element="tns:GetSessionIdResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="GetSessionIdSoapIn">
+ <wsdl:part name="parameters" element="tns:GetSessionId">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="StocksDataSecureHttpGet">
+ <wsdl:operation name="GetSessionId">
+ <wsdl:input message="tns:GetSessionIdHttpGetIn">
+ </wsdl:input>
+ <wsdl:output message="tns:GetSessionIdHttpGetOut">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="StocksDataSecureSoap">
+ <wsdl:operation name="GetSessionId">
+ <wsdl:input message="tns:GetSessionIdSoapIn">
+ </wsdl:input>
+ <wsdl:output message="tns:GetSessionIdSoapOut">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="StocksDataSecureHttpGet" type="tns:StocksDataSecureHttpGet">
+ <http:binding verb="GET"/>
+ <wsdl:operation name="GetSessionId">
+ <http:operation location="/GetSessionId"/>
+ <wsdl:input>
+ <http:urlEncoded/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:mimeXml part="Body"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="StocksDataSecureSoap" type="tns:StocksDataSecureSoap">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="GetSessionId">
+ <soap:operation soapAction="http://www.reuters.com/GetSessionId" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="StocksDataSecure">
+ <wsdl:port name="StocksDataSecureHttpGet" binding="tns:StocksDataSecureHttpGet">
+ <http:address location="test://"/>
+ </wsdl:port>
+ <wsdl:port name="StocksDataSecureSoap" binding="tns:StocksDataSecureSoap">
+ <soap:address location="test://"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>