1 diff -urN php-5.1.4.org/ext/soap/php_encoding.c php-5.1.4/ext/soap/php_encoding.c
2 --- php-5.1.4.org/ext/soap/php_encoding.c 2006-03-03 10:20:33.000000000 +0100
3 +++ php-5.1.4/ext/soap/php_encoding.c 2006-06-21 13:47:15.992015843 +0200
6 static xmlNodePtr check_and_resolve_href(xmlNodePtr data);
8 +static void set_ns_prop(xmlNodePtr node, char *ns, char *name, char *val);
9 +static void set_xsi_nil(xmlNodePtr node);
10 +static void set_xsi_type(xmlNodePtr node, char *type);
12 static void get_type_str(xmlNodePtr node, const char* ns, const char* type, smart_str* ret);
13 static void set_ns_and_type_ex(xmlNodePtr node, char *ns, char *type);
17 if (!zval || Z_TYPE_P(zval) == IS_NULL) { \
18 if (style == SOAP_ENCODED) {\
19 - xmlSetProp(xml, "xsi:nil", "true"); \
26 if (style == SOAP_ENCODED || (SOAP_GLOBAL(sdl) && encode != enc)) {
27 if (zend_hash_find(ht, "enc_stype", sizeof("enc_stype"), (void **)&zstype) == SUCCESS) {
28 - if (style == SOAP_LITERAL) {
29 - encode_add_ns(node, XSI_NAMESPACE);
31 if (zend_hash_find(ht, "enc_ns", sizeof("enc_ns"), (void **)&zns) == SUCCESS) {
32 set_ns_and_type_ex(node, Z_STRVAL_PP(zns), Z_STRVAL_PP(zstype));
35 ret = xmlNewNode(NULL,"BOGUS");
36 xmlAddChild(parent, ret);
37 if (style == SOAP_ENCODED) {
38 - xmlSetProp(ret, "xsi:nil", "true");
43 @@ -1423,12 +1424,7 @@
44 if (Z_TYPE_PP(val) == IS_NULL && model->u.element->nillable) {
45 property = xmlNewNode(NULL,"BOGUS");
46 xmlAddChild(node, property);
47 - if (style == SOAP_ENCODED) {
48 - xmlSetProp(property, "xsi:nil", "true");
50 - xmlNsPtr xsi = encode_add_ns(property,XSI_NAMESPACE);
51 - xmlSetNsProp(property, xsi, "nil", "true");
53 + set_xsi_nil(property);
55 property = master_to_xml(enc, *val, style, node);
56 if (property->children && property->children->content &&
57 @@ -1449,12 +1445,7 @@
58 if (Z_TYPE_P(data) == IS_NULL && model->u.element->nillable) {
59 property = xmlNewNode(NULL,"BOGUS");
60 xmlAddChild(node, property);
61 - if (style == SOAP_ENCODED) {
62 - xmlSetProp(property, "xsi:nil", "true");
64 - xmlNsPtr xsi = encode_add_ns(property,XSI_NAMESPACE);
65 - xmlSetNsProp(property, xsi, "nil", "true");
67 + set_xsi_nil(property);
69 property = master_to_xml(enc, data, style, node);
70 if (property->children && property->children->content &&
71 @@ -1474,12 +1465,7 @@
72 } else if (strict && model->u.element->nillable && model->min_occurs > 0) {
73 property = xmlNewNode(NULL,model->u.element->name);
74 xmlAddChild(node, property);
75 - if (style == SOAP_ENCODED) {
76 - xmlSetProp(property, "xsi:nil", "true");
78 - xmlNsPtr xsi = encode_add_ns(property,XSI_NAMESPACE);
79 - xmlSetNsProp(property, xsi, "nil", "true");
81 + set_xsi_nil(property);
82 if (style == SOAP_LITERAL &&
83 model->u.element->namens &&
84 model->u.element->form == XSD_FORM_QUALIFIED) {
86 xmlParam = xmlNewNode(NULL,"BOGUS");
87 xmlAddChild(parent, xmlParam);
88 if (style == SOAP_ENCODED) {
89 - xmlSetProp(xmlParam, "xsi:nil", "true");
90 + set_xsi_nil(xmlParam);
94 @@ -1694,12 +1680,7 @@
95 if (Z_TYPE_PP(val) == IS_NULL && array_el->nillable) {
96 property = xmlNewNode(NULL,"BOGUS");
97 xmlAddChild(xmlParam, property);
98 - if (style == SOAP_ENCODED) {
99 - xmlSetProp(property, "xsi:nil", "true");
101 - xmlNsPtr xsi = encode_add_ns(property,XSI_NAMESPACE);
102 - xmlSetNsProp(property, xsi, "nil", "true");
104 + set_xsi_nil(property);
106 property = master_to_xml(array_el->encode, *val, style, xmlParam);
108 @@ -2160,7 +2141,7 @@
109 smart_str_append(&array_type, &array_size);
110 smart_str_appendc(&array_type, ']');
111 smart_str_0(&array_type);
112 - xmlSetProp(xmlParam, SOAP_1_1_ENC_NS_PREFIX":arrayType", array_type.c);
113 + set_ns_prop(xmlParam, SOAP_1_1_ENC_NAMESPACE, "arrayType", array_type.c);
116 while (i < array_size.len) {
117 @@ -2169,8 +2150,8 @@
119 smart_str_0(&array_type);
120 smart_str_0(&array_size);
121 - xmlSetProp(xmlParam, SOAP_1_2_ENC_NS_PREFIX":itemType", array_type.c);
122 - xmlSetProp(xmlParam, SOAP_1_2_ENC_NS_PREFIX":arraySize", array_size.c);
123 + set_ns_prop(xmlParam, SOAP_1_2_ENC_NAMESPACE, "itemType", array_type.c);
124 + set_ns_prop(xmlParam, SOAP_1_2_ENC_NAMESPACE, "arraySize", array_size.c);
127 smart_str_free(&array_type);
128 @@ -2426,7 +2407,7 @@
129 xmlAddChild(item,key);
130 if (zend_hash_get_current_key(data->value.ht, &key_val, (long *)&int_val, FALSE) == HASH_KEY_IS_STRING) {
131 if (style == SOAP_ENCODED) {
132 - xmlSetProp(key, "xsi:type", "xsd:string");
133 + set_xsi_type(key, "xsd:string");
135 xmlNodeSetContent(key, key_val);
137 @@ -2435,7 +2416,7 @@
140 if (style == SOAP_ENCODED) {
141 - xmlSetProp(key, "xsi:type", "xsd:int");
142 + set_xsi_type(key, "xsd:int");
144 xmlNodeSetContentLen(key, tmp.c, tmp.len);
146 @@ -2513,7 +2494,6 @@
147 ret = master_to_xml(enc, data, style, parent);
149 if (style == SOAP_LITERAL && SOAP_GLOBAL(sdl)) {
150 - encode_add_ns(node, XSI_NAMESPACE);
151 set_ns_and_type(ret, &enc->details);
154 @@ -3045,7 +3025,7 @@
156 smart_str nstype = {0};
157 get_type_str(node, ns, type, &nstype);
158 - xmlSetProp(node, "xsi:type", nstype.c);
159 + set_xsi_type(node, nstype.c);
160 smart_str_free(&nstype);
163 @@ -3078,6 +3058,21 @@
167 +static void set_ns_prop(xmlNodePtr node, char *ns, char *name, char *val)
169 + xmlSetNsProp(node, encode_add_ns(node, ns), name, val);
172 +static void set_xsi_nil(xmlNodePtr node)
174 + set_ns_prop(node, XSI_NAMESPACE, "nil", "true");
177 +static void set_xsi_type(xmlNodePtr node, char *type)
179 + set_ns_prop(node, XSI_NAMESPACE, "type", type);
182 void encode_reset_ns()
185 @@ -3137,7 +3132,7 @@
186 char *prev_stype = NULL, *cur_stype = NULL, *prev_ns = NULL, *cur_ns = NULL;
188 if (!array || Z_TYPE_P(array) != IS_ARRAY) {
189 - smart_str_appendl(type, "xsd:anyType", 11);
190 + smart_str_appendl(type, "xsd:anyType", sizeof("xsd:anyType")-1);
191 return get_conversion(XSD_ANYTYPE);
194 @@ -3199,7 +3194,7 @@
197 if (different || count == 0) {
198 - smart_str_appendl(type, "xsd:anyType", 11);
199 + smart_str_appendl(type, "xsd:anyType", sizeof("xsd:anyType")-1);
200 return get_conversion(XSD_ANYTYPE);
203 diff -urN php-5.1.4.org/ext/soap/soap.c php-5.1.4/ext/soap/soap.c
204 --- php-5.1.4.org/ext/soap/soap.c 2006-03-24 09:45:54.000000000 +0100
205 +++ php-5.1.4/ext/soap/soap.c 2006-06-21 13:47:25.346782905 +0200
206 @@ -3853,7 +3853,6 @@
208 if (use == SOAP_ENCODED) {
209 xmlNewNs(envelope, XSD_NAMESPACE, XSD_NS_PREFIX);
210 - xmlNewNs(envelope, XSI_NAMESPACE, XSI_NS_PREFIX);
211 if (version == SOAP_1_1) {
212 xmlNewNs(envelope, SOAP_1_1_ENC_NAMESPACE, SOAP_1_1_ENC_NS_PREFIX);
213 xmlSetNsProp(envelope, envelope->ns, "encodingStyle", SOAP_1_1_ENC_NAMESPACE);
214 @@ -4065,7 +4064,6 @@
216 if (use == SOAP_ENCODED) {
217 xmlNewNs(envelope, XSD_NAMESPACE, XSD_NS_PREFIX);
218 - xmlNewNs(envelope, XSI_NAMESPACE, XSI_NS_PREFIX);
219 if (version == SOAP_1_1) {
220 xmlNewNs(envelope, SOAP_1_1_ENC_NAMESPACE, SOAP_1_1_ENC_NS_PREFIX);
221 xmlSetNsProp(envelope, envelope->ns, "encodingStyle", SOAP_1_1_ENC_NAMESPACE);