]> git.pld-linux.org Git - packages/php.git/blob - php-soap.patch
This commit was manufactured by cvs2git to create tag 'auto-ac-php-5_1_5-1'.
[packages/php.git] / php-soap.patch
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
4 @@ -88,6 +88,10 @@
5  
6  static xmlNodePtr check_and_resolve_href(xmlNodePtr data);
7  
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);
11 +
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);
14  
15 @@ -113,7 +117,7 @@
16  { \
17         if (!zval || Z_TYPE_P(zval) == IS_NULL) { \
18           if (style == SOAP_ENCODED) {\
19 -                       xmlSetProp(xml, "xsi:nil", "true"); \
20 +                       set_xsi_nil(xml); \
21                 } \
22                 return xml; \
23         } \
24 @@ -304,9 +308,6 @@
25  
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);
30 -                               }
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));
33                                 } else {
34 @@ -1012,7 +1013,7 @@
35         ret = xmlNewNode(NULL,"BOGUS");
36         xmlAddChild(parent, ret);
37         if (style == SOAP_ENCODED) {
38 -               xmlSetProp(ret, "xsi:nil", "true");
39 +               set_xsi_nil(ret);
40         }
41         return ret;
42  }
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");
49 -                                                       } else {
50 -                                                         xmlNsPtr xsi = encode_add_ns(property,XSI_NAMESPACE);
51 -                                                               xmlSetNsProp(property, xsi, "nil", "true");
52 -                                                       }
53 +                                                       set_xsi_nil(property);
54                                                 } else {
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");
63 -                                               } else {
64 -                                                 xmlNsPtr xsi = encode_add_ns(property,XSI_NAMESPACE);
65 -                                                       xmlSetNsProp(property, xsi, "nil", "true");
66 -                                               }
67 +                                               set_xsi_nil(property);
68                                         } else {
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");
77 -                               } else {
78 -                                       xmlNsPtr xsi = encode_add_ns(property,XSI_NAMESPACE);
79 -                                       xmlSetNsProp(property, xsi, "nil", "true");
80 -                               }
81 +                               set_xsi_nil(property);
82                                 if (style == SOAP_LITERAL &&
83                                     model->u.element->namens &&
84                                     model->u.element->form == XSD_FORM_QUALIFIED) {
85 @@ -1614,7 +1600,7 @@
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);
91                 }
92                 return xmlParam;
93         }
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");
100 -                                               } else {
101 -                                                 xmlNsPtr xsi = encode_add_ns(property,XSI_NAMESPACE);
102 -                                                       xmlSetNsProp(property, xsi, "nil", "true");
103 -                                               }
104 +                                               set_xsi_nil(property);
105                                         } else {
106                                                 property = master_to_xml(array_el->encode, *val, style, xmlParam);
107                                         }
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);
114                         } else {
115                                 int i = 0;
116                                 while (i < array_size.len) {
117 @@ -2169,8 +2150,8 @@
118                                 }
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);
125                         }
126                 }
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");
134                                         }
135                                         xmlNodeSetContent(key, key_val);
136                                 } else {
137 @@ -2435,7 +2416,7 @@
138                                         smart_str_0(&tmp);
139  
140                                         if (style == SOAP_ENCODED) {
141 -                                               xmlSetProp(key, "xsi:type", "xsd:int");
142 +                                               set_xsi_type(key, "xsd:int");
143                                         }
144                                         xmlNodeSetContentLen(key, tmp.c, tmp.len);
145  
146 @@ -2513,7 +2494,6 @@
147         ret = master_to_xml(enc, data, style, parent);
148  /*
149         if (style == SOAP_LITERAL && SOAP_GLOBAL(sdl)) {
150 -               encode_add_ns(node, XSI_NAMESPACE);
151                 set_ns_and_type(ret, &enc->details);
152         }
153  */
154 @@ -3045,7 +3025,7 @@
155  {
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);
161  }
162  
163 @@ -3078,6 +3058,21 @@
164         return xmlns;
165  }
166  
167 +static void set_ns_prop(xmlNodePtr node, char *ns, char *name, char *val)
168 +{
169 +       xmlSetNsProp(node, encode_add_ns(node, ns), name, val);
170 +}
171 +
172 +static void set_xsi_nil(xmlNodePtr node)
173 +{
174 +       set_ns_prop(node, XSI_NAMESPACE, "nil", "true");
175 +}
176 +
177 +static void set_xsi_type(xmlNodePtr node, char *type)
178 +{
179 +       set_ns_prop(node, XSI_NAMESPACE, "type", type);
180 +}
181 +
182  void encode_reset_ns()
183  {
184         TSRMLS_FETCH();
185 @@ -3137,7 +3132,7 @@
186         char *prev_stype = NULL, *cur_stype = NULL, *prev_ns = NULL, *cur_ns = NULL;
187  
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);
192         }
193  
194 @@ -3199,7 +3194,7 @@
195         }
196  
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);
201         } else {
202                 encodePtr enc;
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 @@
207  
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 @@
215  
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);
This page took 0.055848 seconds and 3 git commands to generate.