summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2008-10-16 15:36:46 +0000
committerDmitry Stogov <dmitry@php.net>2008-10-16 15:36:46 +0000
commit35f7c44a7d53166213a865288edafb249cbf36f0 (patch)
tree2cc226205f405d1c8da938590f383c4427fa713d
parentd896ea0b9ab42aa064c25cef6443ac656b70d64b (diff)
downloadphp-git-35f7c44a7d53166213a865288edafb249cbf36f0.tar.gz
Fixed bug #43723 (SOAP not sent properly from client for <choice>)
-rw-r--r--NEWS1
-rw-r--r--ext/soap/php_encoding.c22
2 files changed, 18 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index 5c20c6dd7f..6164f90818 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ PHP NEWS
- Fixed buf #45722 (mb_check_encoding() crashes). (Moriyoshi)
- Fixed bug #44251, #41125 (PDO + quote() + prepare() can result in segfault).
(tsteiner at nerdclub dot net)
+- Fixed bug #43723 (SOAP not sent properly from client for <choice>). (Dmitry)
- Fixed bug #42078 (pg_meta_data mix tables metadata from different schemas).
(Felipe)
- Fixed bug #37100 (data is returned truncated with BINARY CURSOR). (Tony)
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 6df653570b..dc2dcfef2b 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -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 */
@@ -450,14 +451,15 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
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;
- } else if (SOAP_GLOBAL(sdl)) {
- enc = find_encoder_by_type_name(SOAP_GLOBAL(sdl), type_name);
- if (enc) {
- 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;
@@ -1623,6 +1628,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) &&