]> granicus.if.org Git - php/commitdiff
Fixed bug #29839 (incorrect convert (xml:lang to lang))
authorDmitry Stogov <dmitry@php.net>
Thu, 26 Aug 2004 18:40:10 +0000 (18:40 +0000)
committerDmitry Stogov <dmitry@php.net>
Thu, 26 Aug 2004 18:40:10 +0000 (18:40 +0000)
ext/soap/php_encoding.c
ext/soap/php_encoding.h
ext/soap/php_schema.c
ext/soap/php_sdl.c

index 05e2d5143c6675486d425505bb882fc56d3b38e5..99786128684ab85e885162dfb416f5bd03caf94e 100644 (file)
@@ -1357,7 +1357,14 @@ static xmlNodePtr to_xml_object(encodeTypePtr type, zval *data, int style, xmlNo
                                                                if ((*attr)->fixed && strcmp((*attr)->fixed,dummy->children->content) != 0) {
                                                                        soap_error3(E_ERROR, "Encoding: Attribute '%s' has fixed value '%s' (value '%s' is not allowed)", (*attr)->name, (*attr)->fixed, dummy->children->content);
                                                                }
-                                                               xmlSetProp(xmlParam, (*attr)->name, dummy->children->content);
+                                                               if ((*attr)->namens && 
+                                                                   (type->ns == NULL || strcmp((*attr)->namens, type->ns))) {
+                                                                       xmlNsPtr nsp = encode_add_ns(xmlParam, (*attr)->namens);
+
+                                                                       xmlSetNsProp(xmlParam, nsp, (*attr)->name, dummy->children->content);
+                                                               } else {
+                                                                       xmlSetProp(xmlParam, (*attr)->name, dummy->children->content);
+                                                               }
                                                        }
                                                        xmlUnlinkNode(dummy);
                                                        xmlFreeNode(dummy);
index 4d7f75d117d5468d7b61593429026a27f70f28c0..1e26cdb535ae2a9b27d50ab815a7132be6d8fb21 100644 (file)
@@ -43,6 +43,8 @@
 #define XSD_NS_PREFIX "xsd"
 #define XSI_NAMESPACE "http://www.w3.org/2001/XMLSchema-instance"
 #define XSI_NS_PREFIX "xsi"
+#define XML_NAMESPACE "http://www.w3.org/XML/1998/namespace"
+#define XML_NS_PREFIX "xml"
 
 #define XSD_STRING 101
 #define XSD_STRING_STRING "string"
index a1d7ed8514b295f1226cbbf1158ea6731b7e9ca8..0fa5c4a08e0f2a408b81703f30bc34672c09bbca 100644 (file)
@@ -1729,6 +1729,7 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl
                        if (nsptr != NULL) {
                                smart_str_appends(&key, nsptr->href);
                                smart_str_appendc(&key, ':');
+                               newAttr->namens = estrdup(nsptr->href);
                        }
                        smart_str_appends(&key, attr_name);
                        smart_str_0(&key);
@@ -1745,6 +1746,7 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl
                        if (ns != NULL) {
                                smart_str_appends(&key, ns->children->content);
                                smart_str_appendc(&key, ':');
+                               newAttr->namens = estrdup(ns->children->content);
                        }
                        smart_str_appends(&key, name->children->content);
                        smart_str_0(&key);
@@ -2014,6 +2016,9 @@ static void schema_attribute_fixup(sdlCtx *ctx, sdlAttributePtr attr)
                                if ((*tmp)->name != NULL && attr->name == NULL) {
                                        attr->name = estrdup((*tmp)->name);
                                }
+                               if ((*tmp)->namens != NULL && attr->namens == NULL) {
+                                       attr->namens = estrdup((*tmp)->namens);
+                               }
                                if ((*tmp)->def != NULL && attr->def == NULL) {
                                        attr->def = estrdup((*tmp)->def);
                                }
@@ -2071,6 +2076,7 @@ static void schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr, HashT
                                                        memcpy(newAttr, *tmp_attr, sizeof(sdlAttribute));
                                                        if (newAttr->def) {newAttr->def = estrdup(newAttr->def);}
                                                        if (newAttr->fixed) {newAttr->fixed = estrdup(newAttr->fixed);}
+                                                       if (newAttr->namens) {newAttr->namens = estrdup(newAttr->namens);}
                                                        if (newAttr->name) {newAttr->name = estrdup(newAttr->name);}
                                                        if (newAttr->extraAttributes) {
                                                          xmlNodePtr node;
@@ -2330,6 +2336,9 @@ void delete_attribute(void *attribute)
        if (attr->name) {
                efree(attr->name);
        }
+       if (attr->namens) {
+               efree(attr->namens);
+       }
        if (attr->ref) {
                efree(attr->ref);
        }
index d8518cb298d8b300f64773db27500248f22cdd81..8818e72b959157370617bbded25dd1a991a3feb3 100644 (file)
@@ -993,7 +993,7 @@ static sdlPtr load_wsdl(char *struri)
        return ctx.sdl;
 }
 
-#define WSDL_CACHE_VERSION 0x09
+#define WSDL_CACHE_VERSION 0x0a
 
 #define WSDL_CACHE_GET(ret,type,buf)   memcpy(&ret,*buf,sizeof(type)); *buf += sizeof(type);
 #define WSDL_CACHE_GET_INT(ret,buf)    ret = ((unsigned char)(*buf)[0])|((unsigned char)(*buf)[1]<<8)|((unsigned char)(*buf)[2]<<16)|((int)(*buf)[3]<<24); *buf += 4;
@@ -1042,6 +1042,7 @@ static void sdl_deserialize_attribute(sdlAttributePtr attr, encodePtr *encoders,
        int i;
 
        attr->name = sdl_deserialize_string(in);
+       attr->namens = sdl_deserialize_string(in);
        attr->ref = sdl_deserialize_string(in);
        attr->def = sdl_deserialize_string(in);
        attr->fixed = sdl_deserialize_string(in);
@@ -1317,7 +1318,7 @@ static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, time_t t)
        sdlPtr sdl;
        time_t old_t;
        int  i, num_groups, num_types, num_elements, num_encoders, num_bindings, num_func;
-       sdlFunctionPtr *functions;
+       sdlFunctionPtr *functions = NULL;
        sdlBindingPtr *bindings;
        sdlTypePtr *types;
        encodePtr *encoders;
@@ -1472,6 +1473,7 @@ static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, time_t t)
 
        /* deserialize functions */
        WSDL_CACHE_GET_INT(num_func, &in);
+<<<<<<< php_sdl.c
        zend_hash_init(&sdl->functions, num_func, NULL, delete_function, 0);
        functions = emalloc(num_func*sizeof(sdlFunctionPtr));
        for (i = 0; i < num_func; i++) {
@@ -1499,42 +1501,73 @@ static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, time_t t)
                        WSDL_CACHE_SKIP(1, &in);
                        func->bindingAttributes = NULL;
                }
+=======
+       if (num_func > 0) {
+               zend_hash_init(&sdl->functions, num_func, NULL, delete_function, 0);
+               functions = emalloc(num_func*sizeof(sdlFunctionPtr));
+               for (i = 0; i < num_func; i++) {
+                       int binding_num, num_faults;
+                       sdlFunctionPtr func = emalloc(sizeof(sdlFunction));
+                       sdl_deserialize_key(&sdl->functions, func, &in);
+                       func->functionName = sdl_deserialize_string(&in);
+                       func->requestName = sdl_deserialize_string(&in);
+                       func->responseName = sdl_deserialize_string(&in);
+
+                       WSDL_CACHE_GET_INT(binding_num, &in);
+                       if (binding_num == 0) {
+                               func->binding = NULL;
+                       } else {
+                               func->binding = bindings[binding_num-1];
+                       }
+                       if (func->binding && func->binding->bindingType == BINDING_SOAP && *in != 0) {
+                               sdlSoapBindingFunctionPtr binding = func->bindingAttributes = emalloc(sizeof(sdlSoapBindingFunction));
+                               memset(binding, 0, sizeof(sdlSoapBindingFunction));
+                               WSDL_CACHE_GET_1(binding->style,sdlEncodingStyle,&in);
+                               binding->soapAction = sdl_deserialize_string(&in);
+                               sdl_deserialize_soap_body(&binding->input, encoders, types, &in);
+                               sdl_deserialize_soap_body(&binding->output, encoders, types, &in);
+                       } else {
+                               WSDL_CACHE_SKIP(1, &in);
+                               func->bindingAttributes = NULL;
+                       }
+>>>>>>> 1.70.2.3
 
-               func->requestParameters = sdl_deserialize_parameters(encoders, types, &in);
-               func->responseParameters = sdl_deserialize_parameters(encoders, types, &in);
+                       func->requestParameters = sdl_deserialize_parameters(encoders, types, &in);
+                       func->responseParameters = sdl_deserialize_parameters(encoders, types, &in);
 
-               WSDL_CACHE_GET_INT(num_faults, &in);
-               if (num_faults > 0) {
-                 int j;
+                       WSDL_CACHE_GET_INT(num_faults, &in);
+                       if (num_faults > 0) {
+                         int j;
 
-                       func->faults = emalloc(sizeof(HashTable));
-                       zend_hash_init(func->faults, num_faults, NULL, delete_fault, 0);
+                               func->faults = emalloc(sizeof(HashTable));
+                               zend_hash_init(func->faults, num_faults, NULL, delete_fault, 0);
 
-                       for (j = 0; j < num_faults; j++) {
-                               sdlFaultPtr fault = emalloc(sizeof(sdlFault));
+                               for (j = 0; j < num_faults; j++) {
+                                       sdlFaultPtr fault = emalloc(sizeof(sdlFault));
 
-                               sdl_deserialize_key(func->faults, fault, &in);
-                               fault->name =sdl_deserialize_string(&in);
-                               fault->details =sdl_deserialize_parameters(encoders, types, &in);
-                               if (*in != 0) {
-                                       sdlSoapBindingFunctionFaultPtr binding = fault->bindingAttributes = emalloc(sizeof(sdlSoapBindingFunctionFault));
-                                       memset(binding, 0, sizeof(sdlSoapBindingFunctionFault));
-                                       WSDL_CACHE_GET_1(binding->use,sdlEncodingUse,&in);
-                                       if (binding->use == SOAP_ENCODED) {
-                                               WSDL_CACHE_GET_1(binding->encodingStyle, sdlRpcEncodingStyle, &in);
+                                       sdl_deserialize_key(func->faults, fault, &in);
+                                       fault->name =sdl_deserialize_string(&in);
+                                       fault->details =sdl_deserialize_parameters(encoders, types, &in);
+                                       if (*in != 0) {
+                                               sdlSoapBindingFunctionFaultPtr binding = fault->bindingAttributes = emalloc(sizeof(sdlSoapBindingFunctionFault));
+                                               memset(binding, 0, sizeof(sdlSoapBindingFunctionFault));
+                                               WSDL_CACHE_GET_1(binding->use,sdlEncodingUse,&in);
+                                               if (binding->use == SOAP_ENCODED) {
+                                                       WSDL_CACHE_GET_1(binding->encodingStyle, sdlRpcEncodingStyle, &in);
+                                               } else {
+                                                       binding->encodingStyle = SOAP_ENCODING_DEFAULT;
+                                               }
+                                               binding->ns = sdl_deserialize_string(&in);
                                        } else {
-                                               binding->encodingStyle = SOAP_ENCODING_DEFAULT;
+                                               WSDL_CACHE_SKIP(1, &in);
+                                               fault->bindingAttributes = NULL;
                                        }
-                                       binding->ns = sdl_deserialize_string(&in);
-                               } else {
-                                       WSDL_CACHE_SKIP(1, &in);
-                                       fault->bindingAttributes = NULL;
                                }
+                       } else {
+                               func->faults = NULL;
                        }
-               } else {
-                       func->faults = NULL;
+                       functions[i] = func;
                }
-               functions[i] = func;
        }
 
        /* deserialize requests */
@@ -1551,7 +1584,9 @@ static sdlPtr get_sdl_from_cache(const char *fn, const char *uri, time_t t)
                }
        }
 
-       efree(functions);
+       if (functions) {
+               efree(functions);
+       }
        efree(bindings);
        efree(encoders);
        efree(types);
@@ -1619,6 +1654,7 @@ static void sdl_serialize_attribute(sdlAttributePtr attr, HashTable *tmp_encoder
        int i;
 
        sdl_serialize_string(attr->name, out);
+       sdl_serialize_string(attr->namens, out);
        sdl_serialize_string(attr->ref, out);
        sdl_serialize_string(attr->def, out);
        sdl_serialize_string(attr->fixed, out);